开发者

Escape SQL Full Text Conditional Keywords

Can anyone tell me how to have keywords like "AND" and "OR" in the actual search query itself and not get an error? For example:

SEL开发者_StackOverflow中文版ECT *
FROM MyTable
WHERE CONTAINS(MyColumn, 'This and')

I keep getting this error:

Syntax error near 'and' in the full-text search condition 'This and'

Perfectly understandable why there is an error, but how do I ignore the keyword and just have the "and" as part of the search phrase?

Thanks


If this is about MS SQL, then I think you will have to write

SELECT *
FROM MyTable
WHERE CONTAINS(MyColumn, '"This and"')

Note the double quotes

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜