I wanted to trim down the volume of lines I have, so wanted to create a string that I could use many times in the statement.
CURRENTLY this works, but I have it many places:
CASE WHEN Flags IN (
'±4 sigma From Last Point',
'2 Of 3 Points Outside ±2 sigma',
'Downward Data Trend',
'First Point Between ±2SD & ±3SD',
'High Value Delta',
'LOQ',
'n Ascending/Descending Points',
'n Consecutive Points',
'n Points Inside ±1 sigma',
'n Points Outside ±1 sigma',
'n Points Outside ±2 sigma',
'QC Negative 2SD',
'QC Persuasive Consecutive Negative Bias',
'QC Persuasive Consecutive Positive Bias',
'QC Positive 2SD',
'QC Value 4 Sigma Change',
'Rate of Change',
'UDL',
'Upward Data Trend',
'Warning Limit',
'x Of y Points Outside ±2 sigma'
) THEN 1 ELSE 0 END AS Flags_New,
So, I am trying this to set a variable to call repeatedly, but the special character ± is causing havoc:
DECLARE @varFlags AS VARCHAR(MAX)
SET @varFlags = '
'±4 sigma From Last Point',
'2 Of 3 Points Outside ±2 sigma',
'Downward Data Trend',
'First Point Between ±2SD & ±3SD',
'High Value Delta',
'LOQ',
'n Ascending/Descending Points',
'n Consecutive Points',
'n Points Inside ±1 sigma',
'n Points Outside ±1 sigma',
'n Points Outside ±2 sigma',
'QC Negative 2SD',
'QC Persuasive Consecutive Negative Bias',
'QC Persuasive Consecutive Positive Bias',
'QC Positive 2SD',
'QC Value 4 Sigma Change',
'Rate of Change',
'UDL',
'Upward Data Trend',
'Warning Limit',
'x Of y Points Outside ±2 sigma''