Pivoting name value pairs

  • Paul White NZ (4/20/2010)


    pYak (4/20/2010)


    are there any particular cases that you can think of where using the PIVOT operator would be more appropriate?

    Not really, no. The PIVOT is shorthand for a very similar CASE construction - look closely at the execution plans and you'll see the close similarity. PIVOT is not as flexible though, and is often slightly slower.

    I absolutely agree with what Paul said in the quote above. To back up both our claims in that area, here's the link to the article (just in case anyone missed it) that demonstrates both of those claims to an extent, again...

    http://www.sqlservercentral.com/articles/T-SQL/63681/

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • COldCoffee (4/20/2010)


    Jeff, you really are a wonderful character.. and for paul and karthik, thanks for providing new views and test results.. u guys are simply great.. thanks all 🙂

    Shucks. :blush: Thanks, COldCoffee. You and the others made this thread a lot of fun. Thank you for the code you posted and the great attitude that prompted you to do so.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden (4/20/2010)


    COldCoffee (4/20/2010)


    Jeff, you really are a wonderful character.. and for paul and karthik, thanks for providing new views and test results.. u guys are simply great.. thanks all 🙂

    Shucks. :blush: Thanks, COldCoffee. You and the others made this thread a lot of fun. Thank you for the code you posted and the great attitude that prompted you to do so.

    :blush: Thanks sir !

Viewing 3 posts - 31 through 32 (of 32 total)

You must be logged in to reply to this topic. Login to reply