Export (0) Print
Expand All

LIKE Predicate in SharePoint Search SQL Syntax

Last modified: April 21, 2010

Applies to: SharePoint Server 2010

Performs pattern-matching comparison on the specified column.


…WHERE <column> LIKE <wildcard_literal>

The specified column can be a regular or delimited identifier, and must be single-valued; the column cannot be multivalued. The column is also limited to the properties in the property store.

The wildcard literal is a string literal, enclosed in quotation marks, and optionally can contain wildcards. The match string can contain multiple wildcards if needed. The following table describes the wildcard characters that the LIKE predicate recognizes.

Wildcard

Description

Example

% (percent)

Matches zero or more of any character.

comp%r matches "comp" followed by zero or more of any characters, ending in an "r".

_ (underscore)

Matches any single character.

comp_ter matches "comp"

followed by exactly one of any character, followed by "ter".

[ ] (square brackets)

Matches any single character within the specified range or set.

For example [a-z] specifies a range; [aeiou] specifies the set of vowels.

comp[a-z]re matches "comp" followed by a single character in the range of lowercase a through lowercase z, followed by "re".

comp[ao] matches "comp" followed by a single character that must be either a lowercase a or a lowercase o.

[^ ] (caret)

Matches any single character that is not within the specified range or set. For example, [^a-z] specifies a range that excludes lowercase a through lowercase z; [^aeiou] specifies a set that excludes lowercase vowels.

comp[^u] matches "comp" followed by any single character that is not a lowercase u.

Note Note

To match the wildcard characters percent sign (%), underscore (_), or the left square bracket ( [ ), place the character inside square brackets. For example, to match the percent sign, use [%].

Show:
© 2014 Microsoft