Escape Special Characters in SQL Queries


Quick note about some SQL Escape characters:

In SQL you get to define the escape character like so:

select *
from Item
where Name like '%/_%' escape '/'

In this example you will be finding anything in the 'Item' table which contains an underscore anywhere in the 'Name' column. The above syntax is equivalent to:

select *
from Item
where Name like '%=_%' escape '='

Which is equivalent to:

select *
from Item
where Name like '%~_%' escape '~'


For more SQL Escape character information, refer to:

http://www.orafaq.com/wiki/SQL_FAQ#How_does_one_escape_special_characters_when_writing_SQL_queries.3F