Character selection by location in a string

Suppose you had a 4 character field (prefx), and you wanted to find all those records where the 2nd and 4th characters were numeric, with the other two being alphabetic.  Here’s a neat, simple solution:

select * from TableName where prefx like‘[A-Z][A-Z][A-Z][0-9]’

Leave a Reply

Your email address will not be published. Required fields are marked *