As you may be able to tell from the mangled code highlighting, the string
'Jo'Burg'
is not valid. SQL interprets that as the string
'Jo'
, followed by the unknown operator
Burg
, and finally an unterminated string
'
.
To include a single quote in a SQL string, you need to escape it:
CASE
WHEN AD.[Site] = 'Johannesburg' THEN 'Jo''Burg'