1 year ago

#385410

test-img

EDG_507

What is breaking this Case When Statement? (Pardon if this has been asked)

obligatory "New to T-SQL" inserted here. I'm running into an issue where an ' is in the value returned in the data and receive the error "syntax error near 'S'". below is an example of what I am trying to accomplish

CASE 
WHEN Tbl.Data = '1234 SOMETHING DR: @@That'S THE ADDRESS: @MY ADDRESS ' THEN 'That's wrong'
ELSE '' END

For the most part, this statement works and that appears to be the only real difference that I can see compared to other statements in the string. I wholeheartedly apologize if I am using the incorrect terminology and confused you further. Happens to my coworkers all the time. Ha! Thanks in advance for your time.

tsql

ssms

0 Answers

Your Answer

Accepted video resources