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 |
|
rubs_65
Posting Yak Master
144 Posts |
Posted - 2003-10-29 : 10:56:01
|
| Hi,I am trying to write a sql where I don’t want to select row if value of column col3 is character ‘a’ followed by digits 0 to 9 but following sql is not giving me right results:Select col1, col2 from tab1 where col3 not like ‘a[0-9]%’How to pass wild character in query?Thanks--rubs |
|
|
MakeYourDaddyProud
184 Posts |
Posted - 2003-10-29 : 10:59:38
|
| can you give an example of a row that isn't right and are you expecting to exclude data with the column beginning with 'a...' or can the search string be in any point of the column?Daniel Small MIAPwww.danielsmall.com IT Factoring |
 |
|
|
raymondpeacock
Constraint Violating Yak Guru
367 Posts |
Posted - 2003-10-29 : 11:25:01
|
| I've tried the following:create table tab1 (col1 int identity, col2 varchar(20), col3 varchar(20))insert tab1 (col2, col3) values ('first', 'should pass')insert tab1 (col2, col3) values ('second', 'a7c')insert tab1 (col2, col3) values ('third', 'should pass')select * from tab1Select col1, col2 from tab1 where col3 not like 'a[0-9]%'drop table tab1The first Select returns all three rows, the Select using the wildcard returns rows 1 and 3. What results do you get rubs?Raymond |
 |
|
|
|
|
|