title: SQL Switch/Case in 'where' clause
body: <p>I tried searching around, but I couldn't find anything that would help me out.</p>
  
  <p>I'm trying to do this in SQL:</p>
  
  <pre><code>declare @locationType varchar(50);
  declare @locationID int;
  
  SELECT column1, column2
  FROM viewWhatever
  WHERE
  CASE @locationType
      WHEN 'location' THEN account_location = @locationID
      WHEN 'area' THEN xxx_location_area = @locationID
      WHEN 'division' THEN xxx_location_division = @locationID
  </code></pre>
  
  <p>I know that I shouldn't have to put '= @locationID' at the end of each one, but I can't get the syntax even close to being correct. SQL keeps complaining about my '=' on the first WHEN line...</p>
  
  <p>How can I do this?</p>