Effect of exceptions on transactions : TRANCOUNT « Transaction « SQL Server / T-SQL Tutorial






6> BEGIN TRANSACTION
7> GO
1> SELECT 1/0 AS DivideByZero
2> GO
Msg 8134, Level 16, State 1, Server J\SQLEXPRESS, Line 1
Divide by zero error encountered.
1> SELECT @@TRANCOUNT AS ActiveTransactionCount
2> GO
ActiveTransactionCount
----------------------
                     0

(1 rows affected)
1>








23.5.TRANCOUNT
23.5.1.Returning Number of Open Transactions
23.5.2.Effect of exceptions on transactions