• Outstanding article, Tony. Well done. All too often, people will avoid the use of a tool highly appropriate for a given task just because someone says it's a "best practice" to avoid it. Hat's off and a deep bow to SQL Server MVP Peter Larsson for creating and delivering both a solution and a presentation that refutes such a misconception.

    As I say in my signature line as a play on words...

    "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." 😀

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