0

I am using SQL Server and SSMS.

I am writing a CASE expression in SQL. Here is one of the lines

WHEN [Group] = 'Representation Accepted' AND [Reason] = 'Reduced to Warning Notice' Area Authorised' THEN 31

The issue I am having here is that for the string:

Reduced to Warning Notice' Area Authorised

SQL is getting confused with the quotation mark here and believes it to be the end of the condition and completely omits " Area Authorised". I'm not sure how to solve this issue without removing the single quotation mark. Does anyone know how I cam make SQL accept the entire string with the quotation mark as a condition?.

Charlieface
  • 52,284
  • 6
  • 19
  • 43

1 Answers1

1

use two times single quotation as below

WHEN [Group] = 'Representation Accepted' AND [Reason] = 'Reduced to Warning Notice'' Area Authorised' THEN 31
Upender Reddy
  • 568
  • 3
  • 8