Home Forums Reporting Services Reporting Services Passing multi-valued parameter selections in to stored procedures RE: Passing multi-valued parameter selections in to stored procedures

  • I found myself in the same situation and after reviewing many posts couldn't find a simple solution. Then by light bulb turned on.

    This is what I did

    1) I set on of the parameters of my SP for my dataset as:

    ="SELECT '"+JOIN(Parameters!MultiValue1.Value,"' UNION SELECT '") + "'"

    This works for 1,2,...N values selected and it creates a string like this:

    SELECT 'Value1' UNION

    SELECT 'Value2'

    .

    .

    .

    2) In my SP i placed this code

    CREATE TABLE #Tbl_MultiValues(Value_ VARCHAR(100))

    DECLARE @SQLStr VARCHAR(8000)

    SET @SQLStr = 'INSERT INTO #Tbl_MultiValues' + @Value_

    EXECUTE (@SQLStr);

    Then in my WHERE clause

    WHERE TableValue IN(SELECT * FROM #Tbl_MultiValues)

    I hope you find this trick usefull...