• Multiple values in a single parameter don't quite work like that. It is kind of a pain to deal with. However, there is really slick way to parse the value of your parameter into a table. In fact, it is quite useful anytime you need to parse a delimited string.

    Since you didn't post any ddl or sample data I created some based on some other data that I happened to have. This example uses name and State but the concept is much the same. This should do a decent job of demonstrating how this can work.

    if object_id('tempdb..#Names') is not null

    drop table #Names

    create table #Names

    (

    FName varchar(25),

    ST char(2)

    )

    insert #Names

    select 'Francisco', 'PA' union all

    select 'Samuel', 'PA' union all

    select 'Georgia', 'WA' union all

    select 'James', 'MO' union all

    select 'Martha', 'MO' union all

    select 'Connie', 'PA' union all

    select 'Carol', 'PA' union all

    select 'Billy', 'WA' union all

    select 'Ruby', 'WA' union all

    select 'Steve', 'LA'

    --Now we have our example data so we can begin looking the actual problem

    declare @TC varchar(100) = 'PA,MO'

    select *

    from #Names n

    inner join dbo.DelimitedSplit8K(@TC, ',') s on n.ST = s.Item

    --now we only sent in a single value

    set @TC = 'PA'

    select *

    from #Names n

    join dbo.DelimitedSplit8K(@TC, ',') s on n.ST = s.Item

    Now this is NOT going to work on your system without a little effort on your part first. You can find the code for the DelimitedSplit8K function by following the link in my signature about splitting strings.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/