Managing Transactions
With Embedded SQL for C (ESQL/C), you can use the full transaction control facilities of Microsoft® SQL Server™ 2000.
The COMMIT TRANSACTION statement marks the end of a user-defined transaction initiated by a BEGIN TRANSACTION statement. The COMMIT statement makes changes to the transaction's database permanent and visible to other users. It also removes all locks from the affected data so that other users can access the data.
As with other SQL Server applications, statements not bound by BEGIN TRANSACTION and COMMIT TRANSACTION are automatically committed when the statement executes without an error.
The ROLLBACK TRANSACTION statement reverses the effects of a user-specified transaction to the beginning of the OPEN TRANSACTION or to the last save point (marked by a Transact-SQL SAVE TRANSACTION statement) inside the open transaction. After a transaction is committed, it cannot be rolled back.
Note that by default, a COMMIT TRANSACTION or ROLLBACK TRANSACTION statement does not close cursors and applies only to the current connection if multiple connections are active. You can use the SET CURSOR_CLOSE_ON_COMMIT statement to close all cursors on a connection automatically when a COMMIT TRANSACTION or a ROLLBACK TRANSACTION statement is issued.