SAVE TRANSACTION Statement

Sets a savepoint within a transaction.

Syntax

SAVE TRANsaction savepoint_name

where

savepoint_name
Specifies the name assigned to the savepoint. Savepoint names must conform to the rules for identifiers.

Remarks

A user can set a savepoint, or marker, within a transaction. It defines a location to which a transaction can return if part of the transaction might be conditionally canceled. If a transaction is rolled back to a savepoint, it must proceed to completion (with more SQL statements if needed and a COMMIT TRANSACTION statement), or it must be canceled altogether (by rolling it back to its beginning). To cancel an entire transaction, use the form ROLLBACK TRANSACTION transaction_name. All the transaction's statements or procedures are undone.

Important When a transaction begins, resources used during the transaction are held until the completion of the transaction (namely locks). When part of a transaction is rolled back to a savepoint, resources continue to be held until the completion of the transaction (or a rollback of the complete transaction).