'full-text search condition in sql

 select * from quotestable where contains(RelatedKeyword, 'Benjamin Franklin Quotes')

returns an error

 Msg 7630, Level 15, State 3, Line 1
 Syntax error near 'Franklin' in the full-text search condition 'Benjamin Franklin'.

I am surprised as to why. It should ideally search for the word but it has returned error message.



Solution 1:[1]

Try using like this

select * from quotestable where RelatedKeyword like '%Benjamin Franklin Quotes%' 

Solution 2:[2]

Use CONTAINS and CONTAINSTABLE to match words and phrases.

It performs a SQL Server full-text search on full-text indexed columns containing character-based data types.Text Search

select * from quotestable where CONTAINSTABLE(<tablename>, <ColumnName> ,'Benjamin Franklin Quotes')

CONTAINS

select * from quotestable where CONTAINS(<ColumnName> ,'"Benjamin Franklin Quotes"')

word

Is a string of characters without spaces or punctuation.

phrase

Is one or more words with spaces between each word.

Phrases should be enclosed in double quotation marks ("").

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Frost_Mourne
Solution 2