Hi,
Here is my table
Report and some rows to understand what I need :
ID ClosedDate
1 2009-10-10
2 NULL
3 2009-10-12
4 NULL
5 2009-10-14
In a stoed procedure I'm receiving a parameter that specify if I want to hide closed report from my query result.
So when the parameter (
hideClosedDateReport) IS NULL or has a value of
0 then the query must returns all the rows. If the has a value of
1 then the query must only output the date having
ClosedDate NULL.
CREATE PROCEDURE (hideClosedDateReport BIT)
(
SELECT ID, ReportEndingDate
FROM Report
WHERE (hideClosedDateReport IS NULL OR hideClosedDateReport = 0)
OR (hideClosedDateReport = 1 AND ClosedDate IS NOT NULL)
)
I also tried others combinaison but without success...