Searching for Specific Words or Phrases (Simple Term)
In Latin-based and other single-byte languages, a group of characters is typically interpreted as a word if it is framed by spaces or punctuation, and a phrase if it consists of multiple words with spaces, and with (or without) punctuation between them. For example, in the English language, a word such as clock or calendar consists of one or more characters without spaces or punctuation. In most languages, a phrase consists of multiple words with spaces, and with (or without) punctuation between them, such as cheese, crackers, and apple juice.
Asian languages are different in that an Asian language character can also be a word, and a phrase is a group of words that do not necessarily have to have spaces or punctuation between them.
The following query searches for the word business in the notes column of the titles table.
USE pubs GO SELECT title_id, title, notes FROM titles WHERE CONTAINS(notes, 'business') GO
This query searches for the phrase "common business applications" in the notes column of the titles table.
USE pubs GO SELECT title_id, title, notes FROM titles WHERE CONTAINS(notes, ' "common business applications" ') GO
A CONTAINS predicate, can only be used with tables that have columns enabled for full-text querying. For more information about enabling one or more columns for full-text querying, see sp_fulltext_table and sp_fulltext_column and Full-text Indexes.
One or more table columns can be enabled for full-text querying. A given full-text predicate against that table can either access a single, enabled column or all of the enabled columns in a table. Assuming that both the title and notes columns in the titles table in the pubs database are full-text enabled, then the following query returns the title ID, title, and price for all rows in which the phrase "French gourmet" is present in either of the full-text enabled columns:
USE pubs GO SELECT title_id, title, price FROM titles WHERE CONTAINS( *, ' "French gourmet" ' ) GO
The asterisk (*), used in place of a column name, indicates all full-text enabled columns for the table.