• schleep (3/19/2013)


    Yikes. Thanks for pointing that out Jeff.

    I've only (reluctantly) used it with very small sets, mostly in pre-2K5 code.

    I'll be checking my code now...

    You bet and thanks for the feedback.

    If you have something big, a properly configured "Quirky Update" is both bullet-proof and lightning quick. It'll process a million rows in less than 3 seconds on most machines. There are some pretty strict rules to follow to make sure it doesn't go "quirky" on you, but it's usually worth it. It even beats the new functionality they added to SUM() OVER in 2012. It is, however, unsupported and if that's a problem for someone, then just use a recursive CTE or even a fire-hose cursor (likely better than the rCTE but haven't tested it) to do the running total.

    --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)