Monday, October 12, 2009

Escaping special character '%'

You must be aware of the fact that we use '%' to find a pattern in a string:
Eg: WHERE STRING LIKE '%ABC%'
What would you do if you need to search a string that has '%' in it? In other words, how will you escape the special character '%' while searching?

Here is the syntax:
WHERE STRING LIKE  ('%@%%') ESCAPE '@'