title: CASE and IN usage in Sql WHERE clause
body: <p>I'm working on a report and due to a difference in gradings at dataset, I need to be flexible according to parameters. </p>
  
  <p>I want null or graded results only. So a normal where clause would be <code>(x is null or x in (1,2,3))</code></p>
  
  <p>When I try to implement it inside a <code>CASE WHEN</code>, I get syntax errors,</p>
  
  <p>Below is what I tried, this is just trying the dataset part so I wont be hardcoding parameter value after this part</p>
  
  <pre><code>DECLARE @Type NVARCHAR(30)
  set @Type = foo
  
  select COUNT(A) as A,B,C
  FROM Activity act
      inner join x
      inner join v
      inner join  y
      inner join  z
  where 1=1
  and DetailKey = @Type
  and cd.Value is null or IN
        CASE @Type 
           WHEN  'foo' THEN ('1','2','3') ELSE 
           WHEN  'bar' THEN ('YR','OR','DR') END
  </code></pre>
  
  <p>EDIT: Joins are omitted at the example for shortness, they are not the problem.</p>