0

I am having trouble passing parameter to a SQL Server query while using a case statement in where IN clause result not getting populated.

When passing All its working but when passing multiple values it's not working.

This is the SQL Server query that I have tried:

select * 
from 
    (select 
         concat(Size, '-', (case 
                               when Type in ('DC', 'CA', 'GB') 
                                  then 'DC|CA|CB'
                               when Type in  ('MC', 'OP') 
                                  then 'MC|OP'
                               else Type end)) as current, 
         count(distinct(MSQ)) as MSQ  
     from xyz) as b
 where 
     b.current IN (case when {{Parameter}} = 'All' then b.current else {{Parameter}} end)

Again in the above query, when passing {{Parameter}} without case statement it's working but I want it should work with the case.

Any answer will be appreciated.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Mayur
  • 1,123
  • 3
  • 22
  • 38

0 Answers0