[英]SSRS 2008 R2: An expression of non-boolean type specified in a context where a condition is expected, near ','
In my SSRS 2008 R2 report I have a multi-value @Status parameter. 在我的SSRS 2008 R2报告中,我有一个多值@Status参数。 This is the dataset:
这是数据集:
SELECT 1 AS ID, Description
FROM [ApplicationStatus]
WHERE StatusID IN (5, 6, 11, 14)
UNION
SELECT 2 AS ID, Description
FROM [ApplicationStatus]
WHERE StatusID IN (10)
In my main ReportData dataset I have the following filter: 在我的主要ReportData数据集中,我具有以下过滤器:
WHERE ((@Status IN (1) AND a.StatusID IN (5, 6, 11, 14))
OR (@Status IN (2) AND a.StatusID IN (10)))
The report runs fine when selecting either 1 and 2 as the value in the @Status drop-down, but when I select the built-in '(Select All)' option, I get the following error message: 在@Status下拉列表中选择1和2作为值时,报表运行良好,但是当我选择内置的“(Select All)”选项时,出现以下错误消息:
Query execution failed for dataset 'ReportData'.
数据集“ ReportData”的查询执行失败。 An expression of non-boolean type specified in a context where a condition is expected, near ','.
在需要条件的上下文中在“,”附近指定的非布尔类型的表达式。
The multiple values are in @Status, therefore @status needs to be after IN, not before. 多个值位于@Status中,因此@status必须在IN之后,而不是之前。
WHERE (( 1 IN (@Status) AND a.StatusID IN (5, 6, 11, 14))
OR (2 In (@Status) AND a.StatusID IN (10)))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.