'SSRS - Parameter(Multi-Value) Passed to Stored Procedure returns last value

I've used the join function to create a string out of an array of variables.

=Join(Parameters!Variable.Value, ",")

Let's say that the expression is using a parameter called Variable to an expression called varstring. As well as to verify that it's working correctly, I created a text box in my report to show me the output of varstring. It looks like this:

123,456,789

Now I'm passing that string as a variable to a stored procedure. The code in the stored procedure would look similar too:

Declare
@var varchar(30) = varstring;

Select * from table where value in (SELECT * FROM string_split(@var, ','))

Lastly, the Variable parameter in SSRS is set to allow multi-values.

When I run this though, my report only returns records associated to the last string split. So in the above it only returns records equal to 789 in the report.

When I hardcode the values into the stored procedure, it returns records where value equals 123,456, and 789.

What am I missing?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source