Transaction

Table of Contents

Overview
Transactions provide your queries with an "all or nothing" approach to data modifications. In the event that there is an error, the transaction will be rolled back to return the database to the pre-transaction state.

Example
round-pushpin Begins an explicit transaction, perform several operations and then rolls the transaction back.
BEGIN TRANSACTION

DELETE FROM WordList:Word WHERE Text = 'Cat'
DELETE FROM WordList:Word WHERE Text = 'Catboat'
DELETE FROM WordList:Word WHERE Text = 'Catfish'

ROLLBACK TRANSACTION

After the rollback, the database will be in the same state as it was before the transaction began. If we had wanted to keep these changes, we would have called COMMIT TRANSACTION.

Related