The _ (Underscore) Wildcard
An underscore represents a single character. For example, the following query returns employees
where the second character in the last name is e.
SELECT empid, lastname
FROM HR.Employees
WHERE lastname LIKE N'_e%';
This query returns the following output.
empid lastname
----------- --------------------
3 Lew
4 Peled
The [<
List of Characters
>] Wildcard
Square brackets with a list of characters (such as [ABC]) represent a single character that must be one
of the characters specified in the list. For example, the following query returns employees where the
first character in the last name is A, B, or C.
SELECT empid, lastname
FROM HR.Employees
WHERE lastname LIKE N'[ABC]%';
This query returns the following output.
empid lastname
----------- --------------------
5 Buck
8 Cameron
Do'stlaringiz bilan baham: |