Rolls a transaction back to a savepoint inside the transaction or to the beginning of the transaction.
exec sql [at connection_name] rollback [transaction | tran | work] [transaction_name | savepoint_name];
The keywords transaction, trans, and work are interchangeable in the rollback statement, but only work is ANSI-compliant.
The name of the transaction being rolled back.
The name assigned to the savepoint in a save transaction statement. If you omit savepoint_name, SQL Server rolls back the entire transaction.
abort_tran:
exec sql whenever sqlerror continue:
exec sql at connect2 rollback transaction; exec sql at connect1 rollback transaction;
goto try_update;
This reference page mainly describes aspects of the Transact-SQL rollback statement that differ when used with Embedded SQL. See the Adaptive Server Enterprise Reference Manual for more information about the rollback statement, savepoints, and Transact-SQL transaction management.
Transaction names and savepoint names must conform to the Transact-SQL rules for identifiers.
Transaction names and savepoints are Transact-SQL extensions; they are not ANSI-compliant. Do not use a transaction name or savepoint name with the ANSI-compliant keyword work.
begin transaction, commit