Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 Wildcard to show null values?

Author  Topic 

dabooj
Starting Member

7 Posts

Posted - 2010-04-09 : 10:02:21
Hi guys,

I have a query in one of my reporting services reports which is based on a case statement that uses a wildcard. (e.g. HAVING DIRECTORATE_CODE LIKE CASE WHEN @Directorate = 'ALL' THEN '%%' ELSE @Directorate END).
This code is supposed to show all records for directorate when the 'ALL' option is selected from the report filter combo box. This works fine BUT it is currently excluding null values. I'm assuming that the % wildcard ignores nulls.
Is there anyway i can get the case statement (or more specifically the 'THEN' statement) to show all records including the null values when 'ALL' is seleceted?

Regards,

Shuja

Shuja Ahmad
Systems Developer

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-04-09 : 10:38:39
Can you post the full code?

Try this

HAVING (@Directorate ='ALL' or DIRECTORATE_CODE = @Directorate)

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -