Reference Manual
CHAPTER 9. SQL Statements
To terminate a user-defined transaction or make changes to the database permanent.
COMMIT TRAN[SACTION] [ transaction-name ]
None.
None.
The optional parameter transaction-name is the name assigned to this transaction. It must be a valid identifier. You should use transaction names only on the outermost pair of nested BEGIN/COMMIT or BEGIN/ROLLBACK statements.
When executed inside a transaction, the COMMIT TRANSACTION statement decreases the nesting level of transactions by one. When transactions are nested, only the outermost COMMIT makes the changes to the database permanent.
For a discussion of transaction nesting in Adaptive Server Enterprise and Adaptive Server Anywhere, see BEGIN TRANSACTION statement.
Savepoints and the ROLLBACK statement are discussed in SQL Language Elements.
SQL/92 Transact-SQL extension.
Sybase Supported by Adaptive Server Enterprise.
The following Transact-SQL batch reports successive values of @@trancount as 0, 1, 2, 1, 0.
PRINT @@trancount BEGIN TRANSACTION PRINT @@trancount BEGIN TRANSACTION PRINT @@trancount COMMIT TRANSACTION PRINT @@trancount COMMIT TRANSACTION PRINT @@trancount go