Tuesday, 31 July 2018

TSQL - Searching for Escaped Characters

Use the ESCAPE keyword to define a character to use to escape a literal. The _ underscore cannot usually be searched, to do so escape it like this.
SELECT * FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME LIKE '%/_%' ESCAPE '/'

No comments: