Querying with multiple value parameter in SQL Server Report Builder

Mikey G picture Mikey G · Oct 10, 2012 · Viewed 7.3k times · Source

I am basically trying to do what is asked in this question:

Passing multiple values for a single parameter in Reporting Services

but it is not working for me.

My parameter has a data type of text. I have a feeling that my parameter is being surrounded by quotes when it is inserted into my query.

Query

SELECT 
    AllUserData.tp_ID, Title as TestSite, tp_Title as TestCase, nvarchar6 as ItemNumber, 
    nvarchar7 as DefectType, nvarchar8 as Status, nvarchar9 as QuestionID, 
    ntext2 as Question, AllUserData.tp_Version as Version, 
    CONVERT(VARCHAR(10), AllUserData.tp_Modified, 111) AS DateModified
FROM 
    [dbTOG].[dbo].[AllUserData] 
INNER JOIN
    dbTOG.dbo.AllLists on dbTOG.dbo.AllUserData.tp_ListId = dbTOG.dbo.AllLists.tp_ID 
INNER JOIN
    dbTOG.dbo.Webs on dbTOG.dbo.AllLists.tp_WebId = dbTOG.dbo.Webs.Id
WHERE 
    (nvarchar8 = 'PASS' OR
     nvarchar8 = 'FAIL' OR
     nvarchar8 = 'N/A' OR
     nvarchar8 = 'TBD' OR
     nvarchar8 = 'TBRT' OR
     nvarchar8 = 'FIXED') 
    AND Title = @TestSite 
    AND tp_Title IN (@TestCase)

Parameter expression for @TestCase

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

Answer

nicV picture nicV · Aug 13, 2013

This is quite late but I was struggling with pretty much the same thing. Eventually I found the answer from the link in the OT, however not the accepted one.

I changed the parameter expression to:

=SPLIT(JOIN(Parameters!<your param name>.Value,","),",")

This worked perfectly for me.