Hello,
I want to use CONTAINS to search for charater patterns instead of using LIKE
. Here is an example:
Instead of,
Select *
from Northwind.dbo.Categories
Where Description LIKE '%ee%'
I want to use something like,
Select *
from Northwind.dbo.Categories
Where CONTAINS(Description, ' "*ee*" ')
But this doesn't seem to work. I know that the same syntax without the first
'*' works equivalent to LIKE 'ee%'.
Any suggestions?
FarhanContains is used for Full Text Search. Do you have a full text index on
that table?
David Gugick
Imceda Software
www.imceda.com|||Hi,
Thanks for your reply. Every thing is set up correctly, its just that I cant
get CONTAINS to behave as LIKE '%abc%' sort of syntax.
Farhan
"David Gugick" <davidg-nospam@.imceda.com> wrote in message
news:%23D23q$YKFHA.2800@.TK2MSFTNGP10.phx.gbl...
> Contains is used for Full Text Search. Do you have a full text index on
> that table?
> --
> David Gugick
> Imceda Software
> www.imceda.com
>|||Farhan Noor Qureshi wrote:
> Hi,
> Thanks for your reply. Every thing is set up correctly, its just that
> I cant get CONTAINS to behave as LIKE '%abc%' sort of syntax.
> Farhan
>
I think without the first "*" is what you want.
David Gugick
Imceda Software
www.imceda.com|||If I remove the first *, it behaves as LIKE 'abc%' which is a good feature.
But I need to run an equivalent of LIKE '%abc%'.
Farhan
"David Gugick" <davidg-nospam@.imceda.com> wrote in message
news:OZv5jKbKFHA.3340@.TK2MSFTNGP14.phx.gbl...
> Farhan Noor Qureshi wrote:
>
> I think without the first "*" is what you want.
> --
> David Gugick
> Imceda Software
> www.imceda.com|||Farhan & Dave,
Farhan, the leading "*" (asterisk) wildcard in the search condition is
ignored and this is by design for SQL Server 7.0, 2000 and 2005.
SQL FTS only supports a trailing "*" (asterisk) wildcard, i.e.. a wildcard
word-based suffix search, for example, a search for "book*" will find book,
books, booking & booked. A leading "*" (asterisk) wildcard is not supported
because unlike T-SQL LIKE, SQL FTS is a language-specific linguistic search
method, while LIKE is a grep or pattern search method. Would you want to
search on "*og" and find God and Log in the same results?
Regards,
John
--
SQL Full Text Search Blog
http://spaces.msn.com/members/jtkane/
"Farhan Noor Qureshi" <fqureshi@.N-O-S-P-A-MAiroom.com> wrote in message
news:ep1QTbcKFHA.3640@.TK2MSFTNGP12.phx.gbl...
> If I remove the first *, it behaves as LIKE 'abc%' which is a good
feature.
> But I need to run an equivalent of LIKE '%abc%'.
> Farhan
> "David Gugick" <davidg-nospam@.imceda.com> wrote in message
> news:OZv5jKbKFHA.3340@.TK2MSFTNGP14.phx.gbl...
>
No comments:
Post a Comment