How to pass multi-valued parameters in stored procedure in SSRS [duplicate]
Possible Duplicate:
SSRS multi-value parameter using a stored 开发者_如何转开发procedure
How do you pass multi-valued parameters into a stored procedure in SSRS? Please provide an example query or steps.
Create a parameter in your stored procedure that accepts text to handle the multiple values.
You will need to use the IN keyword, and in order to do this you will be required to perform dynamic SQL inside the stored procedure.
A multi-value parameter coming from SSRS containing 3 search values will look something like this '1,2,344'.
CREATE PROCEDURE GetRecords @CustomerId nvarchar(50) AS
Declare @sql nvarchar(max)
Set @sql = 'Select * From Customers Where CustomerId IN (' + @CustomerId + ')'
exec sp_executesql @sql
精彩评论