1. Computing & Technology

Discuss in my forum

Rollback Definition

By , About.com Guide

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
...
SQL Statement(s)
...
ROLLBACK TRANSACTION

The ROLLBACK command can also be used to cancel part of a transaction in the following manner:

BEGIN TRANSACTION
...
SQL Statement(s)
SAVE TRANSACTION savepoint_name
SQL Statement(s)
ROLLBACK TRANSACTION savepoint_name

©2012 About.com. All rights reserved.

A part of The New York Times Company.