Databases

  1. Home
  2. Computing & Technology
  3. Databases

Rollback Definition

By Mike Chapple, About.com

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

Explore Databases

About.com Special Features

Build Your Own Website

Step-by-step advice on how to do everything from choosing a Web host to promoting your content. More >

Connect Your Home Computers

Easy ways to connect two computers for networking purposes. More >

Databases

  1. Home
  2. Computing & Technology
  3. Databases

©2009 About.com, a part of The New York Times Company.

All rights reserved.