title: using Switch like logic in T-SQL
body: <p>This looks like a noob T-SQL question but I want do switch like logic in a stored procedure and I was thinking that using a CASE would be the way to do this with something like </p>
  
  <pre><code> SELECT CASE @Type
          WHEN 1 THEN
              INSERT INTO dbo.Credit (
                  CompanyName,
                  PhoneNumber,
                  City,
                  State
              ) VALUES ( 
                  @CompanyName,
                  @PhoneNumber,
                  @City,
                  @State) 
          WHEN 2 THEN  
              INSERT INTO dbo.Debit (
                  CompanyName,
                  PhoneNumber,
                  City,
                  State
              ) VALUES ( 
                  @CompanyName,
                  @PhoneNumber,
                  @City,
                  @State) 
          WHEN 3 THEN  
              --ETC
       END    
  </code></pre>
  
  <p>but I keep getting errors, is there just a systax error or is what I'm doing out to lunch?</p>