This part of code is in a WHERE clause:
AND
C = CASE
WHEN @Variable = 'NA' THEN C
ELSE LIKE '%' + @Variable + '%'
END
Here's what I want: If @Variable is 'NA'(as in not applicable), then give me all results. If not, I want only C like @Variable.
The error is with the like. If I remove the = from C = CASE, there's no more error with LIKE, but the error is with CASE instead. How should I proceed?