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 percent sign or underscore. 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.
In a LIKE predicate, the percent sign character (%) and the underscore character ( _ ) are used as wildcard characters. In order to use an actual percent sign or underscore character in a LIKE predicate, it must be preceded by an escape character that has been previously defined with the LIKE predicate escape character ODBC escape sequence.
For example, the following SQL statements create the same result set of customer names that start with the characters "%AAA". The first statement uses the escape-sequence syntax. The second statement uses the native syntax for Microsoft Access and is not interoperable. Note that the second percent character in each LIKE predicate is a wild card that matches zero or more of any character.
SELECT Name
FROM Customers
WHERE Name LIKE '\%AAA%' {escape '\'}
SELECT Name
FROM Customers
WHERE Name LIKE '[%]AAA%'
To determine whether the LIKE predicate escape character is supported by a data source, an application calls SQLGetInfo with the SQL_LIKE_ESCAPE_CLAUSE option.