我有以下 WHERE
条款:
WHERE (@Keywords IS NULL
OR (CONTAINS((p.Title, p.Area, p.[Message]), @Keywords))
)
如
@Keywords = 'control'
,然后查询执行成功并过滤我的记录如
@Keywords = 'control of'
,然后我收到以下错误:Syntax error near 'of' in the full-text search condition 'control of'.
为什么会这样,我该怎么做才能解决这个问题?
我使用这种方法而不是使用
LIKE
的主要原因条件是我可以搜索多个单词。
最佳答案
如果要精确搜索 ,请将关键字括在双引号中控制
SET @Keywords = '"control of"'
如果您想搜索 控制和 的 ,使用以下内容:
SET @Keywords = 'control AND of'
但是服务器可以考虑的 作为垃圾或停用词,因此在这种情况下使用以下内容:
SET @Keywords = 'control AND "of"'
关于sql-server-2008 - 全文搜索条件 'of'中 'control of'附近的语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9435119/