• TomThomson (12/29/2014)


    Iwas Bornready (12/29/2014)


    I would never do it this way.

    I would.

    It's much more fun than messing about with strings as Hugo suggests, because it provides useful mental excercise; but of course I'm no longer responsible for any production SQL code, so I can get away with it - - half a dozen years ago I would have regarded as criminal obfuscation. 😛

    Heh... it's ironic that you used two dashes in your explanation because that will make it so no obfuscation is present.

    SELECT correctformulahere --Calculate Christmas of Current Year

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