Sql-server – Handle NULL values in SQL Server Reporting Services

reporting-servicessql serverssrs-2008

I have developed one report using SSRS Report Builder. The report contains several parameters in which one of the parameter contains NULL values apart from the values that it fetches from the database.

Now when I select NON-NULL values from that parameter the report runs fine because I'm using IN Clause (as the parameter values are multi-select). But when I select NULL (and not any other values) from that parameter, the IN clause doesn't works as IN doesn't take NULL.

Hence what/how should I modify my query so that it could handle both — NULL and NON-NULL Values?

Best Answer

The following forces all NULLs to be included and makes it clear to the user of the report that the value is missing:

SELECT ISNULL([ColumnNameHere],'[ None ]') AS [ColumnNameHere]
WHERE ISNULL([ColumnNameHere],'[ None ]') IN (@MultiParam)