Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

CONTAINS in full text index search Expand / Collapse
Author
Message
Posted Friday, July 26, 2013 11:31 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, July 29, 2014 8:49 AM
Points: 151, Visits: 423
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
Post #1478122
Posted Friday, July 26, 2013 11:46 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Yesterday @ 12:30 PM
Points: 1,346, Visits: 1,520
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 ("").

Post #1478133
Posted Friday, July 26, 2013 12:36 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, July 29, 2014 8:49 AM
Points: 151, Visits: 423
Thanks much! enclosing it in double quotes fixed the issue

WHERE contains (*, 'chicago and Boston and "New York"' )
Post #1478152
Posted Friday, July 26, 2013 2:56 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, July 29, 2014 8:49 AM
Points: 151, Visits: 423
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' )
Post #1478209
Posted Friday, July 26, 2013 3:23 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Sunday, September 29, 2013 1:24 AM
Points: 429, Visits: 1,721
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.

 
Post #1478220
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse