Question : Allow a NULL value as a parameter in Reporting Services

In SQL Reporting Service, I would like to know how I can allow a user to select a NULL value as an option in my multi-value parameter.

In my "department" table, there are quite a few NULL records for the DeptKey and DeptUser columns.
On my report I need to be able to show other data even if the department field  is NULL.

Can someone please help me out? Thanks

I've tried the following but it did not work:
SELECT DISTINCT DeptName,DeptKey
FROM Dept
UNION
select 'N/A', -99
WHERE Dept.CreatedDate BETWEEN @StartDate and @EndDate
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
CREATE PROCEDURE [dbo].[GetDeptForFakeReport]
@StartDate DATETIME
@EndDate   DATETIME
 
AS 
 
SELECT DISTINCT DeptKey,DeptName,DeptUser.UserName,ETC...
FROM Dept
LEFT JOIN DeptUser on Dept.DeptKey = DeptUser.DeptKey
WHERE Dept.CreatedDate BETWEEN @StartDate and @EndDate
Open in New Window Select All

Answer : Allow a NULL value as a parameter in Reporting Services

In your example you are only passing the date parameters, so I have added department as an example of how to use a Multi Value with a null to show all.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
CREATE PROCEDURE [dbo].[GetDeptForFakeReport]
@StartDate  DATETIME
@EndDate    DATETIME
@Department INT
 
AS 
 
SELECT DISTINCT DeptKey,DeptName,DeptUser.UserName,ETC...
FROM Dept
LEFT JOIN DeptUser on Dept.DeptKey = DeptUser.DeptKey
WHERE 
(Dept.CreatedDate BETWEEN @StartDate and @EndDate)
AND
(Dept.Department IN (@Department) OR @Department IS NULL)
Open in New Window Select All
Random Solutions  
 
programming4us programming4us