简体   繁体   中英

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".

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.

Thank you.

A multi-select parameter can contain multiple values, so it should be used more like this:

where table.customerId in (@CustomerID)

Perhaps you can elaborate on why you need to assign it to a variable if that won't work for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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