PDA

View Full Version : search table for apostrophe


crmpicco
08-09-2005, 02:01 PM
SELECT * FROM `dbo_tp_countryname` where CountryName like '%'''%'


How do i search a table which has a apostrophe in it? I have tried the above, but it doesnt work.

My error is
Error: You have mismatched `'`

Kid Charming
08-09-2005, 08:56 PM
You need to escape the apostrophe you're searching for:


SELECT
foo
FROM
table
WHERE
bar LIKE '%\'%'