>>---EXEC SQL--.------------.--SAVEPOINT-name--.------.--> +-AT db_name-+ +UNIQUE+ >--.-----------------------------------------------------------.---END-EXEC--->< +--ON ROLLBACK RETAIN CURSORS--.----------------------------+ +--ON ROLLBACK RETAIN LOCKS--+ >>---EXEC SQL--.------------.--SAVE-.-TRANSACTION--.--name-- END-EXEC--->< +-AT db_name-+ +-TRAN---------+ >>---EXEC SQL--.------------.--RELEASE-.----.-SAVEPOINT-name---END-EXEC--->< +-AT db_name-+ +-TO-+
AT db_name | The name of a database that has been declared using DECLARE DATABASE. This clause is not required, and if omitted, the connection automatically switches to the connection associated with the DECLARE CURSOR statement if different than the current connection, but only for the duration of the statement. |
Because SQL Server does not allow save points with fire hose cursors,
EXEC SQL SAVEPOINT SP1 END-EXEC EXEC SQL SAVEPOINT PHASE2 ON ROLLBACK RETAIN CURSORS END-EXEC
Comments:
You can define multiple save points for a single transaction.
When you set a save point using a unique name, and subsequently set another save point using the same unique name, the named save point is reset to the current transaction state.
The behavior of cursors and locks after a rollback to a save point is database-specific. For details, see the documentation provided by your database vendor.