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 |
|
demifelix
Starting Member
22 Posts |
Posted - 2007-11-09 : 12:32:59
|
| Hi,Can someone please help me how to write a proper LIKE statement to perform the search? I have a column with text descriptions of something lik this:1. 'MICROPRINT COLOR COPY'2. 'MICROPRINT INKJET'3. 'MICROPRINT LASER'4. 'MICROPRINT ABC'5. 'MICROPRINT CDE'6. 'MICROPRINT XYZ'7. 'MICROPRINT 123'8. 'MACROPRINT INKJET'...I'm trying to select all records that includes the words 'MICROPRINT' AND does not include the words 'COLOR COPY' OR 'INKJET'. In other words, I'm trying to get all 'MICROPRINT' records except 'MICROPRINT COLOR COPY' and 'MICROPRINT INKJET'.Thanks for your help. |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-11-09 : 12:36:19
|
| select * from YourTablewhere YourColumn not like '%COLOR COPY%' and not like '%INKJET%'note that this would be a lot easier with full text search if you have an option to install it_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com |
 |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-11-09 : 14:12:15
|
quote: Originally posted by spirit1 select * from YourTablewhere YourColumn not like '%COLOR COPY%' and YourColumn not like '%INKJET%'
Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-11-09 : 14:14:10
|
| doh!_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-11-09 : 14:16:43
|
Where is the check for 'MicroPrint'? E 12°55'05.25"N 56°04'39.16" |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-11-09 : 14:24:20
|
i leave that as the excercise for the OP.can't let them have everything now can we _______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
demifelix
Starting Member
22 Posts |
Posted - 2007-11-10 : 20:50:57
|
| Thanks everyone for your help, I got the idea. |
 |
|
|
|
|
|