Rollback Definition
Definition: The ROLLBACK statement in SQL cancels the proposed changes in a pending database transaction. The transaction can be rolled back completely by specifying the transaction name in the ROLLBACK statement. A partial rollback can also be accomplished by specifying a savepoint name in lieu of the transaction name. The alternative to rolling back a transaction is to utilize the COMMIT command to make the proposed changes part of the relational database.
The ROLLBACK statement is used in the following manner to cancel an entire transaction:
BEGIN TRANSACTION [transaction_name]
...
SQL Statement(s)
...
ROLLBACK TRANSACTION [transaction_name]
The ROLLBACK command can also be used to cancel part of a transaction in the following manner:
BEGIN TRANSACTION [transaction_name]
...
SQL Statement(s)
SAVE TRANSACTION savepoint_name
SQL Statement(s)
ROLLBACK TRANSACTION savepoint_name
The ROLLBACK statement is used in the following manner to cancel an entire transaction:
BEGIN TRANSACTION [transaction_name]
...
SQL Statement(s)
...
ROLLBACK TRANSACTION [transaction_name]
The ROLLBACK command can also be used to cancel part of a transaction in the following manner:
BEGIN TRANSACTION [transaction_name]
...
SQL Statement(s)
SAVE TRANSACTION savepoint_name
SQL Statement(s)
ROLLBACK TRANSACTION savepoint_name
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home