Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Old Forums
 CLOSED - General SQL Server
 How to escape apostrophe?

Author  Topic 

yyc
Starting Member

5 Posts

Posted - 2005-05-18 : 10:00:34
I want to search a phrase such as dog's which contains the special character but I find no way to escape it.

I use the following sql,

select title from book where title like '%dog's%'

but it does not work. Any suggestion? Thanks.

yyc

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2005-05-18 : 10:04:01
2 single quotes instead of one. ie: '%dog''s%'

Be One with the Optimizer
TG
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-05-18 : 10:05:28
Try this

select title from book where title like '%dog''s%'


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

yyc
Starting Member

5 Posts

Posted - 2005-05-18 : 12:32:30
Oh thanks a lot guys! I have surf to countless site using google but I can't get a way to solve the problem. The suggestion from both of you really great, thanks again!

yyc
Go to Top of Page
   

- Advertisement -