An optional 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.
The COMMIT statement ends a transaction and makes all changes made during this transaction permanent in the database.
All data definition statements automatically perform a commit. For information, see the Side effects listing for each SQL
The COMMIT statement fails if the database server detects any invalid foreign keys. This behavior makes it impossible to end
a transaction with any invalid foreign keys. Usually, foreign key integrity is checked on each data manipulation operation.
However, if the database option wait_for_commit is set On or a particular foreign key was defined with a CHECK ON COMMIT option,
the database server delays integrity checking until the COMMIT statement is executed.
The use of COMMIT alone is equivalent to COMMIT WORK.
You can use BEGIN TRANSACTION and COMMIT TRANSACTION statements in pairs to construct nested transactions. Nested transactions
are similar to savepoints. When executed as the outermost of a set of nested transactions, the statement makes changes to
the database permanent. 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.
Syntax 2 is a Transact-SQL extension.
In Interactive SQL, you can also execute a COMMIT by:
Clicking SQL » Commit.
In Interactive SQL, executing a COMMIT from the SQL menu or the keyboard shortcut does not modify the contents of the SQL Statements pane; however, the Results tab in the Results pane is cleared.