• DataAnalyst011 (6/27/2013)


    From time to time I need to check if a column is completely numeric (or usually, check for the row contain something other than numeric). I've read the ISNUMERIC has problems. I've used LIKE '%[0-9]%'? successfully, but even after reading around in several places I still don't understand how it works. And I don't want to use anything I can't support. Would someone mind giving me a blow by blow explanation of what each "thing" is doing here? (And if the statement needs to be improved please do so. I've seen some use a ^ in the statement before).

    Based on the word "ISNUMERIC" and the description above, I believe you're looking for an "IsAllDigits" solution. The following article will help with that.

    http://www.sqlservercentral.com/articles/IsNumeric/71512/

    I also recommend that you lookup "LIKE" in Books Online (the "help" system that comes with SQL Server). There will also be a popup when you search for "LIKE" in Books Online with the title "Pattern Matching in Search Conditions". That would be very good to study, as well.

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