Skip to Content
avatar image
Former Member

Value-Range Pattern Matching in SQL Command

I like using the SQL Command under the Database Expert. However, I noticed that pattern matching against a range of values doesn't seem to work as it should.

I want to return all records whose ID# ends with an alphabetic letter. (Note that this ID field is a String)

When I use the following command, nothing shows up:

..... WHERE ID LIKE '%[A-Z]'

Some example values in the ID table:
26219A
23960B
26829C

Edit: (I also tried [a-z], doesn't work either)

Add comment
10|10000 characters needed characters exceeded

  • Hi Erikson,

    What database are you using? The syntax you use in the SQL Command should be the syntax for your database.

    If you were to use the same syntax in your database, does it work? Instead of Like, could you use the Right function and check if the last value is between 'A' and 'Z'?

    Where  Right (table.ID, 1)  Between 'A' and 'Z' 

    This works in SQL Server.

    Good luck,

    Brian

  • Get RSS Feed

0 Answers