Wednesday, August 6, 2014

Trigger_nestlevel(), @@Trancount

Trigger_nestlevel(), @@Trancount

Returns the number of triggers executed for the statement that fired the trigger. TRIGGER_NESTLEVEL is used in DML and DDL triggers to determine the current level of nesting.
@@Trancount –
Returns the number of active transactions for the current connection.
PRINT @@TRANCOUNT

--  The BEGIN TRAN statement will increment the transaction count by 1.

BEGIN TRAN

    PRINT @@TRANCOUNT

--  The COMMIT statement will decrement the transaction count by 1.

    COMMIT

    PRINT @@TRANCOUNT

--Results

--0

--1

--0

No comments:

Post a Comment