Share via


LIKE Predicate

The LIKE predicate performs pattern-matching comparison on the specified column by using the following syntax:

…WHERE <column> LIKE <wildcard_literal>

The column can be a regular or delimited identifier, and must be single-valued. That is, the column cannot be a multi-valued column. 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 wildcards 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  To match the wildcard characters percent sign '%', underscore '_', and the left square bracket '[', place the character inside square brackets. For example, to match the percent sign, use '[%]'

Full-Text Predicates

Literal Value Comparison

MATCHES Predicate

Multi-valued (ARRAY) Comparisons

NULL Predicate