Previous Topic Next topic Print topic


SAVEPOINT

Sets a transaction save point to which a current transaction can be rolled back, resulting in a partial roll back.

Syntax:

>>---EXEC SQL-SAVEPOINT-name---->

 >--.-----------------------------------------------------------.---END-EXEC---><  
    +--ON ROLLBACK RETAIN CURSORS--.----------------------------+
                                   +--ON ROLLBACK RETAIN LOCKS--+

>>---EXEC SQL-SAVE-.-TRANSACTION--.--name-- END-EXEC---><  
                   +-TRAN---------+

Restrictions:

Because SQL Server does not allow save points with fire hose cursors, you must specify the BEHAVIOR directive with the RO_CURSOR=FF primitive directive when compiling SQL Server applications that contain save points.

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.

Example:

EXEC SQL
   SAVEPOINT SP1
END-EXEC

EXEC SQL
    SAVEPOINT PHASE2 ON ROLLBACK RETAIN CURSORS
END-EXEC
Previous Topic Next topic Print topic