Sql server sql中的全文搜索条件

Sql server sql中的全文搜索条件,sql-server,sql-server-2008,Sql Server,Sql Server 2008,返回一个错误 select * from quotestable where contains(RelatedKeyword, 'Benjamin Franklin Quotes') 我很惊讶为什么。理想情况下,它应该搜索该单词,但返回了错误消息。尝试这样使用 Msg 7630, Level 15, State 3, Line 1 Syntax error near 'Franklin' in the full-text search condition 'Benjamin Frankl

返回一个错误

 select * from quotestable where contains(RelatedKeyword, 'Benjamin Franklin Quotes')
我很惊讶为什么。理想情况下,它应该搜索该单词,但返回了错误消息。

尝试这样使用

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

我相信您正在
RelatedKeyword
列中搜索完整的字符串
Benjamin Franklin Quotes

你需要使用双引号来避开单词之间的空格

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

使用
CONTAINS
CONTAINSTABLE
匹配单词和短语

它对
全文索引的

包含基于字符的数据类型的列

单词 是一个没有空格或标点符号的字符串

短语 是一个或多个单词,每个单词之间有空格

短语应该用双引号(“”)括起来


Where Where What Contains???(RelatedKeyword,'Benjamin Franklin Quotes')为什么不使用:从quotestable中选择*Where RelatedKeyword,如'%Benjamin Franklin Quotes%'这些都是全文索引的,因此出于性能原因,我觉得使用Contains比使用like更好。如果我是,请纠正我wrong@Venkat您必须用双引号将“本杰明·富兰克林引号”括起来,如“本杰明·富兰克林引号”
select * 
from quotestable 
where contains(RelatedKeyword, '"Benjamin Franklin Quotes"')
select * from quotestable where CONTAINSTABLE(<tablename>, <ColumnName> ,'Benjamin Franklin Quotes')
select * from quotestable where CONTAINS(<ColumnName> ,'"Benjamin Franklin Quotes"')