Finding an interval of numbers in a char column?

  • joe joe,

    You can also use regular expressions.

    Example:

    SELECT * FROM Test WHERE TESTVAL NOT LIKE '[AB]%' AND TESTVAL NOT LIKE '_[0-9]' AND TESTVAL NOT LIKE '_[0-9][0-9]'

    This will choose any values that meet your criteria.  You can add any letters to the [AB] part that you want to eliminate as the first letter.  The the other not like eliminates any values between 0 and 99, which can be scaled upwards as long as it is in this pattern 9, 99, 999, 9999).

    Let me know if you have issues with your syntax.

     

    Tim Blum
    Senior Manager, Outsourced Data Services
    Learn2Live at Ureach.com

  • Learn2Live - that pattern matching is much neater and infinitely more readable....







    **ASCII stupid question, get a stupid ANSI !!!**

  • Thank you sushila.  I am always happy to give people an alternative way to think about things.  

     

    Tim Blum
    Senior Manager, Outsourced Data Services
    Learn2Live at Ureach.com

  • 1000 Thanks to all of you, my problem is solved

    Joejoe  

Viewing 4 posts - 16 through 19 (of 19 total)

You must be logged in to reply to this topic. Login to reply