COMMIT TRANSACTION (TSQL Statement)

Marks the end of an explicit transaction.

Syntax

COMMIT { TRAN | TRANSACTION } 

Remarks

If @@TRANCOUNT is 0, there is no active transaction. An error is raised.

If @@TRANCOUNT is 1, COMMIT TRANSACTION will make the changes recorded by the current transaction permanent, and @@TRANCOUNT counter will be set to 0.

Else, we are inside a nested transaction (@@TRANCOUNT > 1). COMMIT TRANSACTION will only decrement the counter @@TRANCOUNT, without making the changes permanent.

More Information

See BEGIN TRANSACTION for more information.