Export (0) Print
Expand All

LIKE

SQL Server 2000

Determines whether a given character string matches a specified pattern. A pattern can include regular characters and wildcard characters. During pattern matching, regular characters must match exactly 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. If any of the arguments are not of a character string data type, Microsoft® SQL Server™ 2000 Windows® CE Edition (SQL Server CE) converts them to a character string data type, if possible.

Syntax
match_expression [ NOT ] LIKE pattern [ ESCAPE escape_character ] 
Arguments
match_expression
Is any valid expression in SQL Server CE of nchar, nvarchar, or ntext data type.
pattern
Is the pattern to search for in match_expression and can include the following valid SQL Server CE wildcard characters.
Wildcard character Description Example
% Any string of zero or more characters. WHERE title LIKE '%computer%' finds all book titles with the word 'computer' anywhere in the book title.
_ (underscore) Any single character. WHERE au_fname LIKE '_ean' finds all four-letter first names that end with ean (Dean, Sean, and so on).
escape_character
Is any valid expression in SQL Server CE of any of the data types of the character string data type category. escape_character has no default and must consist of only one character.
Result Types

bit

Result Value

LIKE returns TRUE if the match_expression matches the specified pattern.

Show:
© 2014 Microsoft