title: TSQL: Try-Catch Transaction in Trigger
body: <p>I am trying to put a try-catch statement inside a trigger using Microsoft Server 2005.</p>
  
  <pre><code>BEGIN TRANSACTION
  BEGIN TRY
      --Some More SQL
      COMMIT TRANSACTION
  END TRY
  BEGIN CATCH
      IF (XACT_STATE()) = -1
      BEGIN
          ROLLBACK TRANSACTION;
      END;
  END CATCH
  </code></pre>
  
  <p>The problem is that I don't want the trigger to fail if something is caught by the try-catch block. At the moment, I am getting the error "The transaction ended in the trigger. The batch has been aborted." if the transaction fails. How can I get the trigger to fail gracefully?</p>
  
  <hr>
  
  <p>Additionally, if I remove the transaction, I get the error "Transaction doomed in trigger. Batch has been aborted.".</p>
  
  <pre><code>BEGIN TRY
      --Some More SQL
  END TRY
  BEGIN CATCH
      return
  END CATCH
  </code></pre>
  
  <p>Is there any way around this?</p>