[英]SSRS SQL Query display error after i add where clause
I have a full query which can be display correctly in SSRS, however, when I add this where
clause, I get an error 我有一个完整的查询,可以在SSRS中正确显示,但是,当我添加此
where
子句时,出现错误
Query execution failed for data set 'dataset1'.
数据集“ dataset1”的查询执行失败。 (rsErrorExecutingCommand)
(rsErrorExecutingCommand)
This is the WHERE
clause I add: 这是我添加的
WHERE
子句:
where
(itemNo = @ItemNo or @ItemNo is NULL)
and (JobNo in (@JobNo) or @JobNo is NULL)
and (customerNo = @CustomerNo or @CustomerNo is NULL)
and (LotNo in (@LotNo) or @LotNo is NULL)
and (Station = @Station or @Station is NULL)
and ((DateTimeStamp between @startDate and @endDate) or (@startDate is null and @endDate is Null))
Do you guys have any idea what is the syntax error I did here? 你们知道我在这里发生的语法错误吗?
My codes is working after i add the String. 添加字符串后,我的代码正常工作。 below is what i did, and its working fine.
下面是我的工作,并且工作正常。 This is because,instead of Null, i notice the value is not Null, its a empty string,that is why my codes is not working.
这是因为,我注意到该值不是Null而不是Null,而是一个空字符串,这就是为什么我的代码无法正常工作的原因。
(itemNo = @ItemNo or @ItemNo is NULL or @ItemNo = '')
and(JobNo = @JobNo or @JobNo is NULL or @JobNo = '')
and(customerNo = @CustomerNo or @CustomerNo is NULL or @CustomerNo = '')
and (LotNo = @LotNo or @LotNo is Null or @LotNo = '')
and (Station = @Station or @Station is NULL or Station = '')
and ((DateTimeStamp between @startDate and @endDate) or (@startDate is null and @endDate is Null))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.