NUMBER OF ACTIVE TRANSACTIONS
@@TRANCOUNT shows # of active transactions for the current connection
Select @@TRANCOUNT
If you use savepoint_name in ROLLBACK TRANSACTION @@TRANCOUNT will not be affected
Begin
Begin Transaction
Save TRAN Point1 ;
Select 'The Transaction Count is ' + cast(@@TRANCOUNT as varchar) ;
-- This roll Back will not have any impact on @@TRANCOUNT
RollBack Transaction Point1
Select 'The Transaction Count is ' + cast(@@TRANCOUNT as varchar) ;
-- This roll Back will Reset the @@TRANCOUNT
RollBack Transaction
Select 'The Transaction Count is ' + cast(@@TRANCOUNT as varchar) ;
End
Keywords: @@TRANCOUNT, savepoint_name, Number Of Active Transactions
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment