Re: Different results from like and contains

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Olaf,
Thanks for the heads-up on that information.

"Olaf Pietsch" <olaf_pietsch@xxxxxxxxx> wrote in message
news:%23iWYMNLSIHA.5164@xxxxxxxxxxxxxxxxxxxxxxx
Hi John,

"John Kotuby" <JohnKotuby@xxxxxxxxxxxxxxxxxxxxxxxxx> schrieb im
Newsbeitrag news:%23m1txyKSIHA.4880@xxxxxxxxxxxxxxxxxxxxxxx
I have 2 different queries that I expected to return the same results.

Where Name like '%fish%'
and Where contains((Name),'("*fish*")')

The first returned 181 results and the 2nd returned 178 results.

On closer inspection I determined that the Contains was not returning
Names with words that had "fish" embedded as in:
bigfishtackle.com
flyfishing
kingfisher

I thought that the *fish* would return words where fish was a suffix,
prefix or both.



The search with "*..." (leading asterisk) is not possible with contains,
only the "...*" is possible.

BOL says only:
<prefix_term>
Specifies a match of words or phrases beginning with the specified text.
Enclose a prefix term in double quotation marks ("") and add an asterisk
(*) before the ending quotation mark, so that all text starting with the
simple term specified before the asterisk is matched.
http://msdn2.microsoft.com/en-us/library/ms187787.aspx

Many Ragards,
Olaf
--
Gruß Olaf
Ich unterstütze PASS Deutschland e.V. (http://www.sqlpass.de)
Blog (http://www.sqlpass.de/PASSUserBlogs/tabid/178/Default.aspx?BlogID=3)
Regionalgruppe Köln/Bonn/Düsseldorf
(http://www.sqlpass.de/Regionalgruppen/KoelnBonnDuesseldorf/tabid/81/Default.aspx)



.