I have a stored procedure that has a BEGIN TRANSACTION and COMMIT TRANSACTION statement. Inside the transaction, the WITH(XLOCK, ROWLOCK) query is selected WITH(XLOCK, ROWLOCK) .
A transaction may potentially fail due to some calculations that cause an arithmetic overflow error if values ββare supplied outside the bounds. This error would occur before any insert / update operations.
My question is: should I transfer the transaction to TRY / CATCH and rollbacks or is it really not required and all locks will be released automatically if the transaction fails? My only concern is that SQL will not release all transaction locks in the event of a transaction failure.
Thanks,
Tom
sql-server tsql transactions rollback
Tjf
source share