• Nice article.  It would, however, be helpful if you would attach sample data in the "Resources" section so that people can "play" with your good code for additional learning through experimentation.  I'm a little surprised that the editors didn't ask for such a thing especially since the source data is quite complex.  Fire off a note via the same channels that you submitted the article through with the attachment and they can add it for you.

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