Cur*_*urt 26 full-text-search contains sql-server-2008
我有以下WHERE条款:
WHERE (@Keywords IS NULL
OR (CONTAINS((p.Title, p.Area, p.[Message]), @Keywords))
)
Run Code Online (Sandbox Code Playgroud)
如果@Keywords = 'control',则查询成功执行并过滤我的记录
如果@Keywords = 'control of',那么我得到以下错误:
全文搜索条件'控制'中'of'附近的语法错误.
为什么这样做以及我该怎么做才能解决问题?
我使用这种方法而不是使用LIKE条件的主要原因是我可以搜索多个单词.
Ole*_*Dok 38
如果要完全搜索控件,请将关键字括在双引号中
SET @Keywords = '"control of"'
Run Code Online (Sandbox Code Playgroud)
如果你要搜索的控制和的,使用以下命令:
SET @Keywords = 'control AND of'
Run Code Online (Sandbox Code Playgroud)
但是,服务器可能会考虑的一个垃圾或停止的话,那么在这种情况下使用以下命令:
SET @Keywords = 'control AND "of"'
Run Code Online (Sandbox Code Playgroud)