LIKE and quotes

Post Reply
jkj2001
Posts: 142
Joined: Fri Mar 29, 2002 1:39 pm

LIKE and quotes

Post by jkj2001 »

Hi guys,

Is it possible to do an exact phrase search using like? Something along the lines of:

tsql 'select count(*) from table1 where field01 like "hello*"'

I'd like to retrieve hello* as an exact match, but still use "like". Is this possible? I thought putting hello* in quotes would do it, but from several postings I've read this may not be the case.


Also, I'd like to read up more on your "thesaurus" terms-- you know, where search terms are enclosed in parentheses and joined with commas (word1,word2,word3)-- that sort of thing. I feel a bit like I'm on the outside looking in with regard to it, not quite sure what's happening when you do that, does it act like an OR statement, etc. Can you post a link or two from the manual on this? Thanks again.
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

LIKE and quotes

Post by mark »

You mean take the * literally instead of treating it as a wildcard? All quotes do is bind phrase words together. They do not affect interpretation of what's inside.

Yes, terms within a paren list are treated like an or. (abc,def ghi,jkl) will find any one of abc, "def ghi", or jkl. Make sure you don't add any spaces you don't actually want to search for. The only way to remove the wildcard meaning of * is to use it in a paren list with another term. One that won't match is a good choice. Something like (hello*,qjxz) . That query would require post processing to fully resolve unless you created an index expression to include * characters.

See also
http://thunderstone.master.com/texis/ma ... =3f27d1c28
Post Reply