• LondonNick (4/30/2010)


    A very similar script is in BOL if you look up CHAR.

    Agreed... and it shouldn't be used either. 😉

    For those that haven't seen it, please see the following for how a "Numbers" or "Tally" can be used as a very high performance replacement for certain types of While Loops...

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

    There are dozens of uses for such a table.

    I also agree with Jon... if you find something that may be useful, it's impossible to know if it posted somewhere else or even in BOL. Nothing wrong with posting something you may think is useful even if it's documented in BOL. After all, there are still a lot of folks that don't even know what BOL is never mind having actually read it from top to bottom.

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