LIKE

<field_expr> [ NOT ] LIKE <like_mask>

Determines whether or not a given character string matches a specified pattern. A pattern can include regular characters and wildcard characters. During pattern matching, regular characters must yield a case-insensitive match with the characters specified in the character string. Wildcard characters, however, can be matched with arbitrary fragments of the character string. Using wildcard characters makes the LIKE operator more flexible than using the = and != string comparison operators.

The wildcard characters that can be used in a LIKE pattern are:


Remarks:


Examples

A. LIKE

The following example WHERE clause finds all the URL's in an IISW3C log file that end with ".htm":
WHERE cs-uri-stem LIKE '%.htm'

B. NOT LIKE

The following example WHERE clause finds all the Event Log messages that do not contain "error":
WHERE Message NOT LIKE '%error%'

See also:

Expressions
Field-Expressions

© 2004 Microsoft Corporation. All rights reserved.