sql-server-2008 - 全文搜索条件 'of'中 'control of'附近的语法错误

标签 sql-server-2008 full-text-search contains

我有以下 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/

相关文章:

java - 检查对象列表中的字段是否具有特定值?

c# - 如何开发负载平衡友好的 Web 应用程序

sql-server - 使用其他表中的数据创建计算字段

python - 字符串在另一个字符串中出现了多少次

java - Java 中 String.contains() 的大 O 是什么?

c# - 支票包含数字/数字

sql 在 ssms 中运行快在 asp.net 中慢

sql-server - SQL Server 2008 空间 : find a point in polygon

mysql - 整数值的 SQL 全文搜索解决方法

full-text-search - 使用 DB4O 进行全文搜索