Stuart Leake
Old Hand
Points: 330
More actions
August 23, 2007 at 6:11 am
#70101
Hi Folks
I'm trying to use the LIKE operator to search a string to look for a single quote.
How do I escape the ' char in the LIKE clause
IE LIKE '%'%'
Thanks in advance
Stuart
John Mitchell-245523
SSC Guru
Points: 148809
August 23, 2007 at 6:19 am
#728868
Like this:
CREATE
TABLE #John (John char(10))
INSERT INTO #John VALUES ('1234567890')
INSERT INTO #John VALUES ('!"£$''^&*()')
SELECT
* FROM #John
WHERE John LIKE '%''%'
DROP
TABLE #John
Result set:
John
----------
!"£$'^&*()
August 23, 2007 at 7:11 am
#728890
John,
Great stuff. Thanks for your help.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply