SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


CONTAINS in full text index search


CONTAINS in full text index search

Author
Message
sql server developer
sql server developer
Old Hand
Old Hand (368 reputation)Old Hand (368 reputation)Old Hand (368 reputation)Old Hand (368 reputation)Old Hand (368 reputation)Old Hand (368 reputation)Old Hand (368 reputation)Old Hand (368 reputation)

Group: General Forum Members
Points: 368 Visits: 472
I've enabled full text index search on a column. When I query it WHERE contains (*, 'chicago and Boston' ) its giving results accurately but if I use WHERE contains (*, 'chicago and Boston and New York' ) its failing because there is a space in the word "New York". How can I make it to work?

--Error message for WHERE contains (*, 'chicago and Boston and New York' )
Msg 7630, Level 15, State 3, Line 2
Syntax error near 'York' in the full-text search condition 'chicago and Boston and New York'.

Thanks in advance
batgirl
batgirl
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1707 Visits: 1820
See http://msdn.microsoft.com/en-us/library/ms187787.aspx

It indicates:

Examples of valid simple terms are "blue berry", blueberry, and "Microsoft SQL Server". Phrases should be enclosed in double quotation marks ("").
sql server developer
sql server developer
Old Hand
Old Hand (368 reputation)Old Hand (368 reputation)Old Hand (368 reputation)Old Hand (368 reputation)Old Hand (368 reputation)Old Hand (368 reputation)Old Hand (368 reputation)Old Hand (368 reputation)

Group: General Forum Members
Points: 368 Visits: 472
Thanks much! enclosing it in double quotes fixed the issue

WHERE contains (*, 'chicago and Boston and "New York"' )
sql server developer
sql server developer
Old Hand
Old Hand (368 reputation)Old Hand (368 reputation)Old Hand (368 reputation)Old Hand (368 reputation)Old Hand (368 reputation)Old Hand (368 reputation)Old Hand (368 reputation)Old Hand (368 reputation)

Group: General Forum Members
Points: 368 Visits: 472
Thanks for your help! one more question related to CONTAINS. If I search for lobby is it possible to make it search for lobbies also, which is the plural of lobby? FREETEXT seems to be doing this but I want to do it with CONTAINS because it will me search with an AND clause. FREETEXT using OR clause which I don't need.

For example if I do below search for 'Hotel AND lobby', I would like to get values that have both Hotel and lobby/lobbies

WHERE contains (*, 'Hotel AND lobby' )
Steven Willis
Steven Willis
SSC Eights!
SSC Eights! (825 reputation)SSC Eights! (825 reputation)SSC Eights! (825 reputation)SSC Eights! (825 reputation)SSC Eights! (825 reputation)SSC Eights! (825 reputation)SSC Eights! (825 reputation)SSC Eights! (825 reputation)

Group: General Forum Members
Points: 825 Visits: 1721
sql server developer (7/26/2013)
Thanks for your help! one more question related to CONTAINS. If I search for lobby is it possible to make it search for lobbies also, which is the plural of lobby? FREETEXT seems to be doing this but I want to do it with CONTAINS because it will me search with an AND clause. FREETEXT using OR clause which I don't need.

For example if I do below search for 'Hotel AND lobby', I would like to get values that have both Hotel and lobby/lobbies

WHERE contains (*, 'Hotel AND lobby' )

Answered in your other thread. http://www.sqlservercentral.com/Forums/FindPost1478218.aspx

It's best not to cross-post since some of us are easily confused. Hehe

 
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search