5.1. TRANSACTION CONTROL—ANSI SQL AND MSS
5.1.1. Transaction Concepts
A transaction is a sequence of one or more SQL statements that together form a logical unit of work that must be either applied to the database in their entirety (COMMIT) or discarded completely (ROLLBACK). A transaction is ALL OR NONE; either all parts are recorded to the database or none are. This is known as the Atomic property.
The following is a classic example of a transaction.
Mary goes to the ATM to transfer $1000 from her savings account to her checking account. Her inputs become the following SQL statements.
UPDATE savings SET Balance = Balance _ 1000 WHERE customerid = 444; UPDATE checking SET Balance = Balance + 1000 WHERE customerid = 444;
If these were done ...
Get Transact-SQL Desk Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.