| Author |
Topic |
|
sz1
Aged Yak Warrior
555 Posts |
Posted - 2011-01-19 : 10:08:01
|
| HiHow do I find an exact text search and not LIKE or IN...say for example I want to see only the word 'pda' from a description field and not words containing...Thankssz |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-01-19 : 10:13:42
|
[code]where ' ' + description_column + ' ' like '% pda %'[/code]Edit: % signs added... No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
sz1
Aged Yak Warrior
555 Posts |
Posted - 2011-01-19 : 10:21:13
|
| I've tried %pda% but it bring all words containing like update and things like thatSELECT C1, C2FROM TestdbWHERE Description LIKE %pda%are you saying to use + +so, WHERE ' ' + Description + ' ' LIKE '%pda%'I see what you mean, as the ' ' means nothing so putting nothing either end...is this correct?Thanks |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-01-19 : 10:25:33
|
Have a CLOSER look to my posted solution! No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
sz1
Aged Yak Warrior
555 Posts |
Posted - 2011-01-19 : 10:28:01
|
| Looks like thiswhere ' ' + description_column + ' ' like '% pda %'SoSelect *FROM Testdbwhere ' ' + description + ' ' like '% pda %' |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-01-19 : 10:28:16
|
Ok I will use the word blank if you have to type in a blank space.WHERE 'blank' + Description + 'blank' LIKE '%blankpdablank%' No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
sz1
Aged Yak Warrior
555 Posts |
Posted - 2011-01-19 : 10:32:06
|
| Sorry for my dumbness, yes I know you need a space between the ' ' but when I type this it looks as though there is no space when I publish the text...so basically what you're saying is to add blacnk at either end of the search to make sure nothing is added to the % value %Thanks |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-01-19 : 10:52:41
|
Say your column value would be 'PDA and more'Now my 'blank' + column + 'blank' makes it 'blankPDAblank' on the fly and then you compare it with 'blankPDAblank' and get a match.Say your column value would be 'UPDATE'Now my 'blank' + column + 'blank' makes it 'blankUPDATEblank' on the fly and then you compare it with 'blankPDAblank' and get NO match. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2011-01-19 : 10:57:32
|
How long did you spend thinking of a word with 'PDA' in the middle of it Fred? |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-01-19 : 11:02:09
|
I WOULD spend a very long time I believe! But the OP in his second post in this thread has already had that idea  No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2011-01-19 : 11:05:23
|
| LOL. Yep, I need to learn to read more closely. |
 |
|
|
sz1
Aged Yak Warrior
555 Posts |
Posted - 2011-01-19 : 11:06:45
|
| ChapsI'm only learning this stuff and dont get enough time to play so excuse me, but thank the gods you guys kick ass... |
 |
|
|
|