title: What's wrong with my IF/ELSE? "ELSE: Incorrect syntax near 'ELSE'."
body: <p>I have code similar to this:</p>
  
  <pre><code>DECLARE @IdentificationNumber INT
  DECLARE @Foreign_ID BIGINT
  
  IF ((SELECT COUNT(*) FROM [main-table] WHERE [identification-number] = @IdentificationNumber) &gt; 0)
  
      SET @Foreign_ID = (SELECT [Foreign_ID] FROM [main-table] WHERE [identification-number] = @IdentificationNumber) 
  
      BEGIN
          UPDATE [main-table]
          SET [column1] = '', [column2] = '', [column3] = ''
          WHERE [Foreign_ID] = @Foreign_ID
      END
  
      BEGIN
          UPDATE [table2]
          SET [column4] = '', [column5] = '', [column6] = ''
          WHERE [Foreign_ID] = @Foreign_ID
      END
  
      BEGIN
          UPDATE [table3] 
          SET [column7] = '', [column8] = '', [column9] = ''
          WHERE [Foreign_ID] = @Foreign_ID
      END
      -- and so on, up to 14
  
  ELSE -- "Incorrect syntax near 'ELSE'.
  
      BEGIN
          INSERT into ... -- blah blah blah. 
      END
  </code></pre>
  
  <p>...but I get an error while trying to use <code>ELSE</code>: <code>Incorrect syntax near 'ELSE'.</code></p>