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 2012 Forums
 Transact-SQL (2012)
 Apostorophe within string ERROR

Author  Topic 

Blessed1978
Yak Posting Veteran

97 Posts

Posted - 2015-04-12 : 22:03:58
how would i enter this case statement without getting a syntax error
SELECT
Degree = case when degree = 1 Then 'Master's Degree' when degree = 2
Then 'Bachelor's' else other end FROM MY_TABLE

my error is on the apopstrope of Master's and Bachelor's

stepson
Aged Yak Warrior

545 Posts

Posted - 2015-04-13 : 00:40:38
Try with this, by adding an extra ' :
SELECT
Degree = case when degree = 1 Then 'Master''s Degree' when degree = 2
Then 'Bachelors''s' else other end FROM MY_TABLE


sabinWeb MCP
Go to Top of Page
   

- Advertisement -