Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql SSRS参数未传递到查询中_Sql_Sql Server_Service_Reporting Services_Reporting - Fatal编程技术网

Sql SSRS参数未传递到查询中

Sql SSRS参数未传递到查询中,sql,sql-server,service,reporting-services,reporting,Sql,Sql Server,Service,Reporting Services,Reporting,我的报表中有两个参数@CustomerId和@SalesType,但是@CustomerId参数没有正确地传递到我的报表中,导致错误的是必须声明标量变量“@CustomerId” 下面是我的问题的开始,这是在哪里发生的 Declare @customer nvarchar(max) , @sales varchar(10) Set @customer = @CustomerId; Set @sales = @SalesType; 该参数的大小写正确,是一个多选参数。为什么会发生这种情况?如果我

我的报表中有两个参数@CustomerId和@SalesType,但是@CustomerId参数没有正确地传递到我的报表中,导致错误的是必须声明标量变量“@CustomerId”

下面是我的问题的开始,这是在哪里发生的

Declare @customer nvarchar(max) , @sales varchar(10)
Set @customer = @CustomerId;
Set @sales = @SalesType;
该参数的大小写正确,是一个多选参数。为什么会发生这种情况?如果我定义它是有效的,@SalesType是有效的,那么我就无法解释为什么@CustomerId不是


谢谢。

一个多选参数可以包含多个值,因此应该像这样使用:

其中table.customerId位于(@customerId)


也许您可以详细说明为什么需要将其分配给变量(如果这对您不起作用)。

好吧,您正在获取一个多值报表参数,并尝试将其分配给一个简单的参数。顺便问一下,这样做有什么意义?为什么不直接使用报表参数?报表速度非常慢,建议定义参数以停止参数嗅探。是否有一种特定的方法来定义多值参数?那么,它是否使用存储过程?如果没有,则不进行参数嗅探。如果您实际上使用的是sp,那么您应该在sp内部实现此逻辑,而不是在SSRS数据集中发布参数分配选项卡的屏幕截图吗?发布一些参数和数据集参数视图的屏幕截图,并在开头写下过程的定义