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 |
|
plasmafire
Starting Member
2 Posts |
Posted - 2006-05-21 : 23:45:25
|
| [code]SELECT distinct AssAtt.CharValue as shipment_number FROM AssetAttribute AssAttWHERE AssAtt.AttributeName = 'Reference 04'[/code]is it possible to specify that select only the shipment numbers that are of the formatS<10 numbers> or D<10 numbers> eg: S2000101100 or D2000101100 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-05-21 : 23:55:27
|
will this do ?where AssAtt.CharValue like 'S%'or do you have more criteria ? KH |
 |
|
|
sshelper
Posting Yak Master
216 Posts |
Posted - 2006-05-22 : 00:18:29
|
| Try this:SELECT * FROM (SELECT 'S1234567890' AS ProductUNION ALLSELECT 'S1234' AS ProductUNION ALLSELECT 'D9876543210' AS ProductUNION ALLSELECT 'D9876540' AS Product) AWHERE Product LIKE 'S[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]' OR Product LIKE 'D[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'SQL Server Helperhttp://www.sql-server-helper.com |
 |
|
|
plasmafire
Starting Member
2 Posts |
Posted - 2006-05-22 : 00:36:47
|
| [code]SELECT distinct AssAtt.CharValue as shipment_number FROM AssetAttribute AssAttWHERE AssAtt.AttributeName = 'Reference 04'AND AssAtt.CharValue like '[S,D][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'[/code]This works for me :) Thanks a lot buddies |
 |
|
|
|
|
|