SQL Flow Field Guide

COMMIT TRANSACTION

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

commit

What changes

Input
open transaction
Output or change
makes changes durable when @@TRANCOUNT reaches 0

Syntax at a glance

COMMIT [ { TRAN | TRANSACTION } [ transaction_name | @tran_name_variable ] ] [ WITH ( DELAYED_DURABILITY = { OFF | ON } ) ] [ ; ]

Work example

All required work in the current transaction has passed its checks and can become permanent.

Commit only after every required statement succeeds. Confirm the transaction nesting count before and after.

Check your work The temporary table still contains 8 points after commit. OpenCount is zero.

Practice SQL

Open in SQL Flow
CREATE TABLE #CommitLab (Points int);
BEGIN TRANSACTION;
INSERT INTO #CommitLab VALUES (8);
COMMIT TRANSACTION;
SELECT Points, @@TRANCOUNT AS OpenCount FROM #CommitLab;
DROP TABLE #CommitLab;

Open Microsoft Learn for full syntax, permissions, and details for your version.