CONTAINS Predicate

CONTAINS Predicate

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release. 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.

Syntax

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".

Example

Word and Character Matching

Send us your feedback about the Microsoft Exchange Server 2003 SDK.

Build: June 2007 (2007.618.1)

© 2003-2006 Microsoft Corporation. All rights reserved. Terms of use.