How do I search for a specific word only in full text indexed fields ?
I know I could just do “where field=’word'” but I would rather have the search form as generic as possible and throw the search term to the CONTAINS, FREETEXT functions.
Seems there should be a word boundary or end of phrase character that could be used but there doesn’t seem to be one.
I’m using MS SQL Server 2005.
In order to use Contains or FreeText, you must have a full-text index on the column(s) in question. Assuming you do, then you can force a search for a specific word by enclosing in double-quotes:
CONTAINS (Transact-SQL)
Update
If what you seek is to return results where the contents is only and exactly your search term, then the only way to do that is to use
=orLikewithout a wildcard. I.e., there is no means to search on an exact match of the entire contents using the full-text search predicates. Thus, you must use: