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.
| Author |
Topic |
|
a.ashabi
Posting Yak Master
117 Posts |
Posted - 2008-11-07 : 13:07:52
|
| Hi.I have a column & and want to select the values from that which are like :FB0311Tw0851NW0528which means only those that has two letters at the begining & then numbers.plz help.thank u |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2008-11-07 : 13:15:24
|
| This should do itDECLARE @TABLE Table(Col char(6))INSERT INTO @tableSELECT 'FB0311' UNIONSELECT 'TW0851' UNIONSELECT 'NW0528' UNIONSELECT 'A12345'SELECT * FROM @tableWHERE col like '[A-Z][A-Z]%'Jim |
 |
|
|
a.ashabi
Posting Yak Master
117 Posts |
Posted - 2008-11-07 : 13:23:01
|
| thank u :) |
 |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2008-11-07 : 13:26:17
|
You're welcome Jim |
 |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2008-11-07 : 18:04:40
|
quote: Originally posted by jimf This should do itDECLARE @TABLE Table(Col char(6))INSERT INTO @tableSELECT 'FB0311' UNIONSELECT 'TW0851' UNIONSELECT 'NW0528' UNIONSELECT 'A12345'SELECT * FROM @tableWHERE col like '[A-Z][A-Z]%'AND col NOT LIKE '__%[^0-9]%'Jim
Added a small addition if the ending characters are supposed to be numeric. |
 |
|
|
|
|
|