TechNet
Export (0) Print
Expand All

_ (Wildcard - Match One Character) (Transact-SQL)

 

Applies To: Azure SQL Database, SQL Server (starting with 2008)

THIS TOPIC APPLIES TO:yesSQL Server (starting with 2008)yesAzure SQL DatabasenoAzure SQL Data Warehouse noParallel Data Warehouse

Matches any single character in a string comparison operation that involves pattern matching, such as LIKE and PATINDEX.

The following example uses the _ operator to find all the people in the Person table, who have a three-letter first name that ends in an.

-- Uses AdventureWorks  
  
SELECT FirstName, LastName  
FROM Person.Person  
WHERE FirstName LIKE '_an'  
ORDER BY FirstName;  

LIKE (Transact-SQL)
PATINDEX (Transact-SQL)
Percent character (Wildcard - Character(s) to Match) (Transact-SQL)
(Wildcard - Character(s) to Match) (Transact-SQL)
(Wildcard - Character(s) Not to Match) (Transact-SQL)

Community Additions

ADD
Show:
© 2016 Microsoft