title: SQL Server 2008 Transaction, rollback required?
body: <p>I have a stored procedure that has a <code>BEGIN TRANSACTION</code> and <code>COMMIT TRANSACTION</code> statement. Within the transaction is a select query <code>WITH(XLOCK, ROWLOCK)</code>. </p>
  
  <p>The transaction can potentially fail due to some calculations that cause an arithmetic overflow error if out of bounds values are supplied. This error would happen before any insert/update statements.</p>
  
  <p>My question is, should I wrap the transaction in a TRY/CATCH and rollback or is this not really required and all locks would be released automatically if the transaction fails? My only concern here is that SQL would not release all locks of the transaction in case the transaction fails.</p>
  
  <p>Thanks,</p>
  
  <p>Tom</p>