skip to main content
SQL Escape Sequences : Like Predicate Escape Characters
 

Like Predicate Escape Characters

In a LIKE predicate, the percent sign (%) matches zero or more of any character and the underscore (_) matches any one character. To match an actual percent sign or underscore in a LIKE predicate, an escape character must precede the % or _. The escape sequence that defines the LIKE predicate escape character is:
{escape 'escape-character'}
where escape-character is any character supported by the data source.

Example

SELECT Name FROM Customers
WHERE Name LIKE '\%AAA%' {escape '\'}
Returns all the customers for which the name starts with “%AAA”.