I would love to have a t-sql statement like the following…
SELECT [field]
FROM [table]
WHERE CASE @flag
WHEN 1 THEN col1 = @value
ELSE col2 = @different_value
END
The point being I want to put a flag in my function to use different where clauses in the same query. I just can’t get it to work. Is this possible?
Will this work for you?