Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 T-SQL String Functions

Author  Topic 

smccreadie
Aged Yak Warrior

505 Posts

Posted - 2001-06-22 : 07:03:44
I'm attempting to pull data from a varchar column where the first 4 letters of the string are letters AND the last 4 are integers (I don't care about anything that's in the middle).

Some sample data I want to pull are codes such as DICLO1001, AZITH1002 but not NPR250OB, ACY200O4, etc.

The code I'm trying is:

select * from om_cis_06_22
where LEFT(order_code,4) LIKE '[A-Z]' AND RIGHT(order_code, 4) LIKE '[1-9]'


This returns zero rows.

Any ideas how to make this work?

   

- Advertisement -