timscronin (7/1/2013)
wont happen, the records with the 2 characters at the end are state abbreviations added on
Then it's easy... Build a "State" table (you should have one anyway) and the your WHERE clause would look like the following...
WHERE RIGHT(PatID,2) IN (SELECT StateAbbv FROM dbo.State)
Be advised that no matter what you do, performance is going to stink because of the PatID column being wrapped in a function. What I'd recommend doing if you need to do this a lot is to make the RIGHT(Pat,2) a PERSISTED calculated column in the table and index it.
--Jeff Moden
Change is inevitable... Change for the better is not.