SQL Flow Field Guide

SAVE TRANSACTION

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

named savepoint

What changes

Input
open transaction
Output or change
savepoint marker

Syntax at a glance

SAVE { TRAN | TRANSACTION } { savepoint_name | @savepoint_variable } [ ; ]

Work example

A larger transaction needs a named point for partial rollback without ending the outer transaction.

Use a unique savepoint name and verify the transaction is committable before rolling back to it.

Check your work The read shows 8 points and one open transaction. Only the change after KeepFirst was undone.

Practice SQL

Open in SQL Flow
CREATE TABLE #SaveLab (Points int);
INSERT INTO #SaveLab VALUES (5);
BEGIN TRANSACTION;
UPDATE #SaveLab SET Points = 8;
SAVE TRANSACTION KeepFirst;
UPDATE #SaveLab SET Points = 12;
ROLLBACK TRANSACTION KeepFirst;
SELECT Points, @@TRANCOUNT AS OpenCount FROM #SaveLab;
COMMIT TRANSACTION;
DROP TABLE #SaveLab;

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