• pietlinden (8/25/2013)


    LOL, thanks.

    The funny thing was that I figured it out after posting a couple of times. I guess posting forces me to re-read a bunch of my code to see if it actually does make sense, and there was one part of the pattern I wasn't getting - the recursive member. (And I'd just finished watching Rick Morelan's video on it, too... and I still messed it up!)

    It probably won't help you because you have a really small hierarchy to contend with, but if you ever run across something larger, the following articles should help quite a bit.

    http://www.sqlservercentral.com/articles/Hierarchy/94040/

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

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