The ACID Properties

Transactions must adhere to a set of requirements, known as the ACID properties. ACID is an acronym for four interdependent properties: Atomicity, Consistency, Isolation, and Durability. Much of the architecture of any modern relational database is founded on these properties. Understanding the ACID properties of a transaction is a prerequisite for understanding many facets of SQL Server.

Atomicity

A transaction must be Atomic, meaning all changes made by the transaction are completed as a single unit, or none of the changes are made. If a partial transaction were committed, the atomic property is violated, and the database is left in an inconsistent state. The ability to commit or roll back transactions is required for Atomicity.

Consistency

The transaction must preserve database Consistency, which means that the database must begin the transaction in a state of consistency and return to a state of consistency when the transaction is complete.

Consider the following example. Assume a foreign key constraint exists between a table named Orders and a table named OrderDetails based on a field named OrderID. This constraint ensures that before an OrderID exists in the OrderDetails table, the OrderID must first exist in the Orders table. If a transaction were to fail to write a record to the Orders table but successfully writes the record to the OrderDetails table, the database would no longer be in a consistent state.

Consistency allows for the database to be in ...

Get Microsoft SQL Server 2012 Bible 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.