escape character sql code example
Example 1: sql escape quote
DECLARE @my_table TABLE (
[value] VARCHAR(200)
)
INSERT INTO @my_table VALUES ('hi, my name''s tim.')
SELECT * FROM @my_table
Example 2: sql quote in string
on P.SupplierID=S.SupplierID
where S.CompanyName in
('Tokyo Traders','Exotic Liquids','Grandma Kelly''s Homestead')
Example 3: sql escape &
SELECT 'Smith ' || chr(38) || ' Smith, since 1938.' FROM DUAL;
Example 4: escape-character-in-sql-server
To escape the character in SQL SERVER just put the single quotes
infront of the one that you're trying to escape.
e.g select 'it''s escaped'