2016-01-20 82 views
0

我需要使用日期参数来设计报告(需要在英国的日期格式)参数在SSRS报告中未拿起NULL值显示为空白

Original date format: 2007-11-30 00:00:00.000 

So, I am using CONVERT(Date, Start_Date, 103): 2007-11-30 in my query. 

Data in Query: 

Start_Date   End_Date    Type 
---------------------------------------------------------------  NULL     2016-01-23     3 Month 
2009-08-11   2009-07-27     3 Month 
NULL     2015-10-13     3 Month 
NULL     2016-02-16     3 Month 
NULL     2015-12-28     3 Month 

现在在设计报告我使用这个数据集:

主要数据集查询:

SELECT Col1, Col2, Start_Date, Target_Date, Col3 
FROM Table 
WHERE  (Col1 IN (@Param1)) 
AND (Col2IN (@Param2)) 
AND (Start_Date IN (@Start_Date)) AND (Target_Date IN (@Target_Date)) 

Now, When I run this report for Start_Date = 2009-08-11 and End_Date = 2009-07-27 and Type= 3 Month I get detailed data in report. 

However, When I select Start_Date = NULL and End_Date = 2016-02-16 and Type= 3 Month my report appears blank. I checked dataset and that too returns all values as NULL. 

您能否就这个问题提出建议/帮助?

问候, AR

回答

0
Start_Date = NULL 

不会work.You需要使用

Start_Date IS NULL 

ISNULL(Start_Date, 0) = 0 

所以是这样的:

SELECT Col1, Col2, Start_Date, Target_Date, Col3 
FROM [Table] 
WHERE Col1 IN (@Param1) 
     AND Col2 IN (@Param2) 
     AND ISNULL(Start_Date, 0) IN (ISNULL(@Start_Date, 0)) 
     AND ISNULL(Target_Date, 0) IN (ISNULL(@Target_Date, 0));