Forum Replies Created

Viewing 15 posts - 2,386 through 2,400 (of 10,144 total)

  • RE: Stairway to Advanced T-SQL Level 6: Creating Rows Of Data Using The UNPIVOT Operator

    g.britton (6/24/2015)


    Greg Larsen (4/27/2015)


    Comments posted to this topic are about the item <A HREF="/articles/Stairway+Series/125504/">Stairway to Advanced T-SQL Level 6: Creating Rows Of Data Using The UNPIVOT Operator</A>

    Consider using CROSS APPLY...

  • RE: Are the posted questions getting worse?

    GilaMonster (6/25/2015)


    I found a photo of my Siamese.

    *sniff*

    I'm very sorry for your loss.

  • RE: Combined Ranking

    bugg (6/25/2015)


    ChrisM@Work (6/25/2015)


    Yes, or this which looks a little cleaner:

    SELECT

    rn = ROW_NUMBER() OVER(PARTITION BY s.fruit ORDER BY s.Preference),

    max_rn = COUNT(*) OVER(PARTITION BY s.fruit),

    s.*,

    p.OrderQuantity

    INTO #StreamedData

    FROM @tmp s

    INNER JOIN @purchase...

  • RE: Combined Ranking

    Yes, or this which looks a little cleaner:

    SELECT

    rn = ROW_NUMBER() OVER(PARTITION BY s.fruit ORDER BY s.Preference),

    max_rn = COUNT(*) OVER(PARTITION BY s.fruit),

    s.*,

    p.OrderQuantity

    INTO #StreamedData

    FROM @tmp s

    INNER JOIN @purchase p

    ON...

  • RE: Combined Ranking

    bugg (6/25/2015)


    ChrisM@Work (6/24/2015)


    I wonder how a rCTE version would fare, in terms of performance?

    Very cool 🙂

    I've amended the code to pull in unassigned order quantities similar to spaghetti's output 🙂

    DECLARE...

  • RE: Get Prior Max of Quantity

    sreeram.sivakumar 61990 (6/24/2015)


    ...

    The prior max should be calculated based on source and destination keys.

    Please list the rules for the calculation.

  • RE: Are the posted questions getting worse?

    dwain.c (6/25/2015)


    BWFC (6/25/2015)


    Chattering?! What a great word for that vocalization! I know immediately what you are talking abut.

    Did you read that somewhere or come up with it on your own?...

  • RE: What is wring with my SQL ? Why am I getting the same item repeated ?

    mw112009 (6/24/2015)


    ...THE SQL syntax was fine!

    The query is at stage 1 of the three stages of SQL development:

    1. Make it work

    2. Make it fast

    3. Make it pretty (formatting and documentation)

    Don't...

  • RE: What is wring with my SQL ? Why am I getting the same item repeated ?

    I think your query should look something like this:

    SELECT

    T.RDW_PATIENT_ID,

    x.PE_DVT

    FROM #t T

    CROSS APPLY (

    SELECT STUFF( (

    SELECT ',[<' + CONVERT( CHAR(8), s.ActivityDate, 112 ) + '>' + s.TermDescription +...

  • RE: Pivot, unpivot

    It's a bad idea as Drew points out, but it's not difficult to do. It's an unusual requirement and often it's a step in a process which would be difficult...

  • RE: Actual text value of Null

    samartel (6/24/2015)


    Quick one for you all. I dont have access to test this or I would but I know you all are quick to help a brother out.

    I have...

  • RE: Combined Ranking

    spaghettidba (6/24/2015)


    ChrisM@Work (6/24/2015)


    I wonder how a rCTE version would fare, in terms of performance?

    Brilliant! Works like a treat!

    I've recently implemented a solution here which is essentially the same as the...

  • RE: Tuning SQL Server query

    Minaz Amin (6/24/2015)


    I will test on DEV first and follow up with all the env.

    Can you post the Actual Execution Plan as a .sqlplan attachment? This would help folks evaluate...

  • RE: Combined Ranking

    I wonder how a rCTE version would fare, in terms of performance?

    DECLARE @tmp TABLE (fruit VARCHAR(50), shop VARCHAR(10), preference INT, InStock INT)

    INSERT INTO @tmp (fruit,shop,preference,InStock) VALUES ('orange','shop 1',1 ,4)

    INSERT INTO...

  • RE: Are the posted questions getting worse?

    Jeff Moden (6/22/2015)


    Eirikur Eiriksson (6/22/2015)


    ChrisM@Work (6/22/2015)


    Alvin Ramard (6/22/2015)


    GilaMonster (6/22/2015)


    It's starting to look like the replication which keeled over last week did so because the passwords on the distributor were changed....

Viewing 15 posts - 2,386 through 2,400 (of 10,144 total)