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 |
|
AsimKhaliq
Yak Posting Veteran
94 Posts |
Posted - 2004-11-29 : 09:48:41
|
| hi guysI have a prolem in making logic and finding and functions inn writing a query for my search.Create table ABC( description varchar(200))insert into ABC values('Men Sleeve less shirt')insert into ABC values('women Sleeve less shirt')insert into ABC values('Men Sleeveless shirt')insert into ABC values('women Sleeveless shirt')insert into ABC values('Men Sleeveless shirts')Now i am typing Men's sleeveless shirts. and breaking my search term with spaces. Now if i run my query below, it is not giving me any record caz of Men's. My user can type men sleeveless shirtwomen sleeveless shirtmen sleeve less shirtsSo if i run my query the number of results are not exact what my user wants to get.SELECT * from abc Where description like '%Men's%' AND description like 'SleeveLess%' AND description like '%Shirts%'feel free to ask meThanks |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-11-29 : 10:08:48
|
try replacing '%Men's%' with '%Men''s%'Go with the flow & have fun! Else fight the flow |
 |
|
|
AsimKhaliq
Yak Posting Veteran
94 Posts |
Posted - 2004-11-29 : 10:16:21
|
| thanksok but my concern is i dont have any men's in my description plus if iam using like operator i will get women results too if i am typing men caz women have men part. If u guys know how i can make my query work better, plz guide meThanks again |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-11-29 : 10:46:06
|
use:'%[^a-zA-Z]Men''s[^a-zA-Z]%'Go with the flow & have fun! Else fight the flow |
 |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2004-11-29 : 10:57:40
|
quote: caz women have men part
first of all women do not have men parts... but thats another topic on topic: Spirit, he doesn't want the apostrophe...Suggestions: - change your application so that the user chooses between men and women. That way you know exactly what the criteria options are
- replace (mens,men's,etc) with men before you search
There may be others... Corey |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-11-29 : 12:13:47
|
| Have you looked at full text search?==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|