• Ramesh Saive (2/8/2010)


    Jeff Moden (2/6/2010)


    ...... I should have qualified my statement. Instead of saying...

    "I believe you'll find it's a wee bit more difficult to do than just using REPLACE."

    ... I should have said...

    "I believe you'll find it's a wee bit more difficult to do it in a high performance manner using just REPLACE.".......

    I knew it was coming, Jeff.:-) I know you would always come up with more optimized solution than this.

    And I agree with you on the reusable optimized code; there is really no harm in using optimized code though it is for a one time or one row execution.

    Thank you Jeff, for taking time and letting me know few of the cases where a while loop beats a tally table.

    I wonder how many more cases I would see where a while loop beats a tally table.:-)

    Heh... guess I'm shootin' blanks, lately. Paul White's code above is much faster. Like he said, "an order of magnitude faster". Thanks for the compliment anyway, Ramesh.

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