title: CASE WHEN 'All'
body: <p>I have an issue, within a stored procedure, that I cannot figure out. I need to have a case filter applied for 5 items, and if it is one specific item, I need it to return all previous 5 items.</p>
  
  <p>Code goes something like this:</p>
  
  <pre><code>...
  WHERE [dbo].[ID] = CASE @var
    WHEN 'a' THEN 0
    WHEN 'b' THEN 1
    WHEN 'c' THEN 2
    WHEN 'd' THEN 3
    WHEN 'e' THEN 4
    WHEN 'all' THEN -- return 0 through 4 as possible answers
  END
  </code></pre>