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
精彩评论