• CELKO (9/3/2012)


    You gave us no DDL, so this will be harder than it should. I assume that you want to get rid of this function. Good SQL never use them; they are proprietary, non-relational, screw up the optimizer and scream to the world that the author is still stuck in 1960's BASIC

    Absolutely incorrect on all counts. This an Inline Table Value Function that the optimizer weaves into the code as if it were a view. "Good SQL [sic]" should always use them for this type of thing. It doesn't matter if they're proprietary because, except for the most basic of CRUD, true portability is a bloody myth. They ARE relational because they work like a view. And it would seem that the only one stuck in the 1960's is you because you didn't know this. 😉

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