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
 General SQL Server Forums
 New to SQL Server Programming
 IN Statement

Author  Topic 

Trininole
Yak Posting Veteran

83 Posts

Posted - 2013-07-17 : 12:23:49
How do you include a word with an apostrophe in an SQL in statement without getting an error msg? For example this syntax:

where provname1 IN ('Children's')

With that syntax above, I would get an error message.

Roger DeFour

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-07-17 : 12:29:57
where provname1 IN ('Children''s')

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

Trininole
Yak Posting Veteran

83 Posts

Posted - 2013-07-17 : 12:32:41
Thank you

Roger DeFour
Go to Top of Page

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-07-17 : 13:49:36
See the reason here: http://myshallowsqlblog.wordpress.com/escaping-single-quotes-in-sql/
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-07-18 : 01:25:48
quote:
Originally posted by Trininole

Thank you

Roger DeFour


this is a good example to understand the usage of ' in SQL Server

http://sqlblogcasts.com/blogs/madhivanan/archive/2008/02/19/understanding-single-quotes.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -