title: Update statements - capture errors and continue with the rest
body: <p>I have around 2000 SQL update commands to run and I know that some of them may fail for various reasons. I'd like to run them all, or in batches, and capture the failures for those that fail, while continuing to go through the rest of the list.</p>
  
  <p>Two approaches that i'm looking at are:</p>
  
  <p><code>XACT Abort</code></p>
  
  <pre><code>set xact_abort on
  begin transaction
   -- Updates here --
  commit transaction
  </code></pre>
  
  <p><code>Try catch</code></p>
  
  <pre><code>BEGIN TRY
      -- Updates here --
  END TRY
  BEGIN CATCH
      SELECT 
          ERROR_NUMBER() AS ErrorNumber,
          ERROR_SEVERITY() AS ErrorSeverity,
          ERROR_STATE() AS ErrorState,
          ERROR_PROCEDURE() AS ErrorProcedure,
          ERROR_LINE() AS ErrorLine,
          ERROR_MESSAGE() AS ErrorMessage
  END CATCH
  </code></pre>
  
  <p>The problem with these is that when they fail, they fail (at least, this is what happened in my testing). Then I have to fix the problem with whichever line it fails on and start it again. I want to ignore and log any failures then continue. Is this possible using either <code>xact_abort</code> or a <code>try catch</code> type query or should I be looking at something else?</p>