• Chirag (3/23/2009)


    Jeff

    I mistook this (1230-544,15C5487,132DE78) for a single value rather than 3 values that they are. I assume the op wanted to process one value.

    Using a number table would be the best way of doing this.

    Assuming you have a number table called number this is the query

    select substring('1230-544',number,1)

    from number where number <= len('1230-544')

    and substring('1230-544',number,1) like '[%0-9%]'

    Understood and thanks for the feeback, Chirag... just wanted you to know that recursion should be avoided even more than a well written cursor is.

    Also, your query doesn't put it all back together like the op wanted and you don't need the % signs in the like because you're looking at a single character.

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