Forum Replies Created

Viewing 15 posts - 3,391 through 3,405 (of 3,957 total)

  • RE: Sum the most recent record for each day

    vinu512 (6/18/2012)


    You can do it like this as well:

    --Creating Temporary Table

    CREATE TABLE #Test

    (

    DateTimeStamp datetime,

    Value int

    )

    --Inserting Sample Data

    INSERT INTO #Test SELECT '2012-06-15 16:00:00.000',4

    INSERT INTO #Test SELECT '2012-06-15 2:05:00.000',5

    INSERT INTO #Test...

  • RE: Tsql help on Passing values as parameters

    That's because I didn't notice that Horse is the exception where it should be < while the others are greater than.

    You can change the logic on the INNER JOIN to...

  • RE: Tsql help on Passing values as parameters

    etirem (6/17/2012)


    But can I get the results without using XML and pass them as variables as below.

    Presumably so but IMHO it is messier.

    Personally, I like to pass as...

  • RE: Tsql help on Passing values as parameters

    Like this:

    DECLARE @Result1 NVARCHAR(100),

    @ResultValue1 NVARCHAR(100),

    @Result2 NVARCHAR(100),

    @ResultValue2 NVARCHAR(100),

    @Result3 NVARCHAR(100),

    @ResultValue3 NVARCHAR(100),

    @Result4 NVARCHAR(100),

    @ResultValue4 NVARCHAR(100)

    SET @Result1 = 'Cat'

    SET @ResultValue1 = 200--(Greater Than...

  • RE: Tsql help on Passing values as parameters

    etirem (6/17/2012)


    The below values need to be passed as parameters from SSRS report and these values may change everytime the report is ran. So they cannot be put into a...

  • RE: Looking for a good online source to learn xml

    Thomas Stringer (6/17/2012)


    For what it's worth, at least for me, the light bulb really comes on with XML and it's much easier to understand when you actually practice with it....

  • RE: Tsql help on Passing values as parameters

    etirem (6/17/2012)


    I need to pass the values in SSRS report for the parameters. And here you are hardcoding the required values into #pTable but need to pass them. Please help.

    I...

  • RE: Tsql help on Passing values as parameters

    No need to pass 4 parameters. Below, I haven't created your SP but have given you everything you need to do so.

    DECLARE @XML1 XML, @XML2 XML

    IF object_id ('Tempdb..#pTable') IS...

  • RE: Sum the most recent record for each day

    I believe that this will also produce satisfactory results:

    ;WITH CTE AS (

    SELECT DateTimeStamp, Value

    ,n=ROW_NUMBER() OVER (

    ...

  • RE: need to replace

    On the other hand, perhaps the solution is as simple as this:

    DECLARE @t TABLE (column1 VARCHAR(20))

    INSERT INTO @t

    SELECT 'p = 30'

    UNION ALL SELECT 'q = 50'

    UNION ALL SELECT 'r =...

  • RE: Programmatically creating a table alias

    Lowell (6/15/2012)


    dwain.c (6/14/2012)


    Lowell - Another nice learning experience from you. That's now 2 in as many days!

    I see this was introduced in SQL 2005. Any idea if it...

  • RE: Need Help in Query

    Lynn Pettis (6/15/2012)

    Not running your code, but what do you return if the mobility indicator is not 1? The OP indicated that it should be blank.

    Plus, I find the...

  • RE: Need Help in Query

    Kingston Dhasian (6/15/2012)


    dwain.c (6/15/2012)


    Kingston Dhasian (6/15/2012)


    dwain.c (6/15/2012)


    Jeez Kingston, you've let the cat out of the bag!!

    Actually you don't need to do a JOIN of any sort.

    Yes, the OP's statement actually...

  • RE: Unpivoting Data

    My findings were overall (multiple runs) about 3% decrease in execution time on a single UNPIVOT. CPU savings were about 30% though.

    Double UNPIVOT was 30% and 30%.

  • RE: Need Help in Query

    Kingston Dhasian (6/15/2012)


    dwain.c (6/15/2012)


    Jeez Kingston, you've let the cat out of the bag!!

    Actually you don't need to do a JOIN of any sort.

    Yes, the OP's statement actually made us feel...

Viewing 15 posts - 3,391 through 3,405 (of 3,957 total)