CONTAINS Predicate

Topic Last Modified: 2006-06-13

Use the Structured Query Language (SQL) CONTAINS Predicate as part of a WHERE Clause to search for a word or phrase as specified. Only whole words are matched.

CONTAINS( [" propertyNAME " | * , ] ' searchspec ' )

The parameter propertyNAME is optional. If not specified, only the message or document body is searched. Use this parameter to search a property marked for Full-Text Indexing in addition to searching the body. Use an asterisk (*) to include all properties marked for full-text indexing.

The property must be a quoted string, such as "urn:schemas:mailheader:to". An asterisk for this parameter is not surrounded by quotation marks.

The searchspec parameter is the string to search for. See Token Formats for usage of single and double quotation marks. This parameter is case-sensitive. You can use the FORMSOF Predicate in this parameter, and the following operators:

Operator Operator Word Operator Symbol

and

AND

&

or

OR

|

Note

The NOT operator is only supported if it follows an AND operator.

Remarks

CONTAINS can only function if Full-Text Indexing is applied to the store being searched. Common words, such as "and", "is", "but", and "the", also known as noise words, are bypassed in a search.

Only items with the exact sequence are matched, for example "Seasons Greetings".