No, you need to use the IF statement for this logic, since in the CASE statement you basically return a value. You can do something like this:
declare @result varchar(500) SET @result = CASE WHEN @Color = 'Blue' THEN 'Water' WHEN @Color = 'Black' THEN 'Oil' WHEN @Color = 'Red' THEN 'HELP! I''m bleeding' END IF @Color = 'Red' PRINT @result
But I think about the best you could do. Personally, I would just use the IF here, as this is the best choice.
source share