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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 String with single quote in list

Author  Topic 

osupratt
Posting Yak Master

238 Posts

Posted - 2008-07-28 : 10:59:30
I'm having an issue with a list as follows:

WHEN invheader.APVendorName IN ('SOUTHWEST INTERNATIONAL TRUCKS','SOUTHWEST INTERNATIONL TRUCKS','SOUTHWEST INT'L TRUCKS','SOUTHWEST INT'L TRUCKS, INC.') THEN 'SOUTHWEST INTL TRUCKS'

It's giving me syntax error because of the single quote in INT'L which is in between to single quotes for the string. Does anyone know how to solve this? Thanks.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-28 : 11:05:35
put one more ' to escape it

WHEN invheader.APVendorName IN ('SOUTHWEST INTERNATIONAL TRUCKS','SOUTHWEST INTERNATIONL TRUCKS','SOUTHWEST INT''L TRUCKS','SOUTHWEST INT''L TRUCKS, INC.') THEN 'SOUTHWEST INTL TRUCKS'
Go to Top of Page

osupratt
Posting Yak Master

238 Posts

Posted - 2008-07-28 : 11:08:01
wow. thanks. never figured that out.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-07-28 : 11:11:39
http://sqlblogcasts.com/blogs/madhivanan/archive/2008/02/19/understanding-single-quotes.aspx

Madhivanan

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

- Advertisement -