Forum Replies Created

Viewing 15 posts - 256 through 270 (of 366 total)

  • RE: Extended challenge for everyone

    Drop table test if it exist

    Create table test

    Create unique clustered index (id,colid,name)

    June 8, 2005 at 4:25 pm

    #564015

  • RE: 5 mins report

    True Frank and I adjusted the code (including correcting the spelling errors) to yeild the results for the 5 min intervals and had intended to post both the corrected code...

  • RE: How to deal with this DATETIME issue!

    As usual Frank has the answer. I did not read the original post close enough. Parsing the input to the desired format ISO standard will solve the problem.

    Mike

  • RE: How to deal with this DATETIME issue!

    If you are parssing the 2 input paramaters as a string dmy there should be no problem. Or am I still missing something.  Mike

    Edited [if this does not work try an...

  • RE: How to deal with this DATETIME issue!

    Hi SQL will handle the conversion for you. You can use either. between or <= and >=

    HTH Mike

    declare @StartDate datetime,

     @EndDate datetime

     

    set @StartDate = '01/02/2005'

    set @EndDate = '01/31/2005'

    Select * From temperatures

    Where...

  • RE: 5 mins report

    Bselzer that is very very cool.

    Mike

  • RE: Execution plan differences

    Cris have you tried switching the order of the statements when testing. i.e. test statement 2 then 1 then 3

    Mike

  • RE: Convert VARCHAR to DECIMAL as rows are returned???

    You can also use cast to convert from one data type to another.

    HTH Mike

    SELECT DATE_STAMP_ "DateTime", Cast(DATA_VALUE_ AS Decimal(19,4)) "Value"

    FROM  dbo.trenddata

    WHERE TID_ = @TID AND @StartDate <= DATE_STAMP_ AND @EndDate >=...

  • RE: Neater way of joining?

    I am not sure what you need. Could you send the table def, some sample data and the expected results?

     Mike

     

  • RE: Neater way of joining?

    You can use one statement if I understand what you want.

    SELECT something

    FROM YourTable

    WHERE FieldID = 2542

     OR FieldID = 2541

     OR..ect

     AND eventID = 26

    Selects all somethings with a fieldID of 2542 or...

  • RE: Neater way of joining?

    I am a little confused. What is your primary key? Can you post a copy of your Table(s) definition and explain what you are trying to do.

    The general form of...

  • RE: Output Parameters for a newbie

    Usage for the above sp

    HTH Mike

    Declare @TotalUsed varchar(50),

    @s-2 decimal(19,4)

    Create Table #Test

    (

     PeakValue Decimal(19,4),

     FirstValue Decimal(19,4)

    )

    Execute @totalUsed = sp_TrendPeakTotalModified 11,'2003/5/1','2003/7/1',@S

     

    Drop Table #Test

    /*

    SHOULD BE 299.36567

    Returns 299.3657

    */

  • RE: Output Parameters for a newbie

    Try this sp

    if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_TrendPeakTotalModified]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)

    drop procedure [dbo].[sp_TrendPeakTotalModified]

    GO

    SET QUOTED_IDENTIFIER OFF

    GO

    SET ANSI_NULLS ON

    GO

    CREATE PROCEDURE sp_TrendPeakTotalModified

    -- declare the...

  • RE: Output Parameters for a newbie

    Edited: Scrapped my previous post as it was returning incorrect data. Based on the following data (from K-Michael just cleaned up) the correct answer is 299.3657. My sp was returning...

  • RE: setting default datetime

    Sorry but I can not recreate your problem.

    HTH Mike

    CREATE TABLE #TEST

    (

     DT datetime default('2005/1/20'),

     val int

    )

    insert into #Test(Val)Values(1)

    insert into #Test Values(cast('1/21/99' as datetime),2)

    select * from #Test

    DROP TABLE #Test

    /* returns

    2005-01-20 00:00:00.000 1

    1999-01-21 00:00:00.000 2

    */

Viewing 15 posts - 256 through 270 (of 366 total)