SQL allows you to group multiple statements into a single "atomic" (indivisible) piece of work called a transaction. If two statements are in the same transaction, and either statement fails, you can use the ROLLBACK statement to restore things as they were before the transaction started — this prevents half-successful transactions from occurring. Successful transactions are preserved with the statement COMMIT WORK. For example:
COMMIT WORK; -- Finish the previous transaction. UPDATE stores SET balance = balance + 199.95 WHERE store_name = 'Big Tyke Bikes'; UPDATE checking_accounts SET balance = balance - 199.95 WHERE name = 'Jay Smith'; COMMIT WORK;