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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 Old Forums
 CLOSED - General SQL Server
 How to escape apostrophe?
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

5 Posts

Posted - 05/18/2005 :  10:00:34  Show Profile
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.


Flowing Fount of Yak Knowledge

6065 Posts

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

Be One with the Optimizer
Go to Top of Page

Premature Yak Congratulator

22864 Posts

Posted - 05/18/2005 :  10:05:28  Show Profile  Send madhivanan a Yahoo! Message
Try this

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


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

Starting Member

5 Posts

Posted - 05/18/2005 :  12:32:30  Show Profile
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!

Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000