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
 apostrophe

Author  Topic 

kky2k
Starting Member

3 Posts

Posted - 2009-02-25 : 16:11:25
how can I insert an apostrophe to the following:

CASE
WHEN code.cd = '12345' THEN 'Kim's List' (Can't get it to come up as Kim's List)
END

Thanks!!!

Kim

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-02-25 : 16:13:12
quote:
Originally posted by kky2k

how can I insert an apostrophe to the following:

CASE
WHEN code.cd = '12345' THEN [Kim's List]
(Can't get it to come up as Kim's List)
END

Thanks!!!

Kim


Go to Top of Page

mfemenel
Professor Frink

1421 Posts

Posted - 2009-02-25 : 16:21:24
Double the apostrophe in Kim's.
then 'Kim''s List' end


Mike
"oh, that monkey is going to pay"
Go to Top of Page

kky2k
Starting Member

3 Posts

Posted - 2009-02-25 : 16:34:47
try both, receiving a missing keyword error.

please advise.

Thanks,

Kim
Go to Top of Page

kky2k
Starting Member

3 Posts

Posted - 2009-02-25 : 16:37:32
opps..my mistake. I made a typo along the way. the double apostrope did the trick. Thank you so much for the help!!!
Go to Top of Page

LoztInSpace
Aged Yak Warrior

940 Posts

Posted - 2009-02-26 : 07:12:04
Without knowing your actual problem this might be better solved by having a table and joining to it.
Even something like

select * from
blah inner join
(
select 12345 cd ,'kim''s list' desc union all
select 65323 , 'loztinspace''s list'
) as list
on blah.cd=list.cd

if you need a default then outer join and coalece to the default value.
Depends on your situation though.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-03-02 : 02:54:44
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 -