• mister.magoo (11/12/2012)


    I have made a revision and I would be interested if you could take a look at it and let me know what you think?

    It replaces the recursive CTE with my favourite toy - the Identity Hack.

    Either they publish the article earlier where you hail from or you caught the article discussion link on the forums. I wasn't expecting any replies tonight, Magoo! 😀

    I've not tested your modifications, yet, but I did look them over and that's a VERY interesting hack on the rCTE that you've built. And, yeah, I can see that being a lot quicker and less resource intensive than an rCTE. Very well done and I'm looking forward to testing that bit of SQL prestidigitation out sometime tomorrow.

    Thank you very much for the addition to the code and for the feeedback. It's always a pleasure to see you in action.

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