Easy way to replicate SSRS Multi-Select Parameter from SSRS in TSQL?

  • When attempting to diagnose issues with SSRS Reports, I often run into an issue where there is a multi-select parameter that needs to be populated.  I have been creating a table variable and populating that with the values, and then updating the query to use IN (SELECT value from @tablevariable) , which is ok, but when you have a lot of multi-select parameters, is a real pain, not to mention it requires that I have to alter the query in SSMS , and then remember to fix everything when I finally figure out what is going wrong.  

    Is there a better way to deal with a multiselect parameter in TSQL ?

  • Multi-select parameters are passed to stored procedures as a comma-delimited list.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • drew.allen - Wednesday, February 20, 2019 7:43 AM

    Multi-select parameters are passed to stored procedures as a comma-delimited list.

    Drew

    Don't you need to use the Join() function in SSRS to get that to happen?  That's in the parameters for the dataset where you would supply the expression...

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • sgmunson - Wednesday, February 20, 2019 1:37 PM

    Don't you need to use the Join() function in SSRS to get that to happen?  That's in the parameters for the dataset where you would supply the expression...

    That's how I've typically done it with the expression:
    =Join(Parameters!ParameterName.Value,",")

    And then the query for that last dataset just has:
    WHERE TheColumnUsedForTheParameters in (@ParameterName)

    Sue

  • sgmunson - Wednesday, February 20, 2019 1:37 PM

    drew.allen - Wednesday, February 20, 2019 7:43 AM

    Multi-select parameters are passed to stored procedures as a comma-delimited list.

    Drew

    Don't you need to use the Join() function in SSRS to get that to happen?  That's in the parameters for the dataset where you would supply the expression...

    Not when you are passing it to a stored procedure.  It's not clear whether he is passing the parameters to a stored procedure or not.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply