title: Case statement in SQL Server 2005
body: <p>I am not sure what to use in this scenario, but I think a Case statement is apt.</p>
  
  <p>I do not know the syntax however. Can someone please guide me?</p>
  
  <p>I have a variable called <code>@Action</code> which can have about 30 different values.</p>
  
  <p>I want to do something like this</p>
  
  <pre><code> CASE
   WHEN @Action = 'InsertTbl1' THEN 
    BEGIN
     -- Some Insert statements and one update statements
    END
   WHEN @Action = 'RecalculateCol3' THEN 
    BEGIN
     -- Some update statements
    END
   WHEN @Action = 'Closed' THEN 
    BEGIN
     -- Some delete statements and some update statements
  
    END
  --- and so on.....
   ELSE 
    BEGIN
    END
   END
  </code></pre>