简体   繁体   English

SSRS参数未传递到查询中

[英]SSRS Parameter Not Passing Into Query

I have two parameters in my report, @CustomerId and @SalesType, however the @CustomerId parameter is not passing correctly into my report and results in the error Must declare the scalar variable "@CustomerId". 我的报表中有两个参数@CustomerId和@SalesType,但是@CustomerId参数未正确传递到我的报表中,并导致错误必须声明标量变量“ @CustomerId”。

Below is the beginning of my query where this is happening. 以下是发生这种情况的查询开头。

Declare @customer nvarchar(max) , @sales varchar(10)
Set @customer = @CustomerId;
Set @sales = @SalesType;

The parameter is the correct case and is a multi-select parameter. 该参数是正确的情况,并且是多选参数。 Why could this be happening? 为什么会这样呢? If i define it it work, @SalesType works so im stuck why @CustomerId isnt. 如果我定义它有效,则@SalesType起作用,以至于为什么@CustomerId不起作用。

Thank you. 谢谢。

A multi-select parameter can contain multiple values, so it should be used more like this: 多选参数可以包含多个值,因此应更像这样使用它:

where table.customerId in (@CustomerID) (@CustomerID)中的table.customerId

Perhaps you can elaborate on why you need to assign it to a variable if that won't work for you. 也许您可以详细说明为什么对您不起作用,为什么需要将其分配给变量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM