I would like to get the data which will exclude weekends from result based on a bind variable value. Somehow I am not able to get this query to run.
select * from tablename a
WHERE a.date >= '2015-04-13'
AND a.date <= '2015-04-21'
AND CASE WHEN :1 = 'Y' THEN ((DATEPART(dw, a.date) + @@DATEFIRST) % 7) NOT IN (0, 1) END
I am getting the following error : Incorrect syntax near the keyword 'NOT'.