Skip to Content
0

Value-Range Pattern Matching in SQL Command

Feb 10, 2017 at 12:06 AM

26

avatar image

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)

SQL
10 |10000 characters needed characters left 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

0
* Please Login or Register to Answer, Follow or Comment.

0 Answers