The ACID test for T-SQL batch statements
Barrie Sosinsky, Contributor
Have you ever wondered if there are some commands that can't be part of a SQL named transaction? Well, as a matter of fact, there are. The restriction comes about because of something called the ACID test. This test defines the properties a Transact-SQL batch statement must have to qualify as a transaction.
ACID stands for:
- Atomicity
- Consistency
- Isolation
- Durability
Atomicity means that changes are either completely made, or are discarded. Consistency refers to leaving all data in a consistent state at the end of a transaction, and that your database maintains its integrity. Isolation makes a transaction separate from and not dependent in any way on another transaction. Finally, durability requires that the completed transaction, once committed,
Premium Access
Register now for unlimited access to our premium content across our network of over 70 information Technology web sites.
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States.
Privacy
Dig Deeper
-
People who read this also read...
This was first published in March 2005
becomes part of the database and is not reversible (except through a complete ROLLBACK, for example).
We don't normally think about these different requirements, as T-SQL will attend to the details for you. Once you complete the BEGIN TRANSACTION / COMMIT TRANSACTION cycle your transaction has the properties of ACID. You can't modify a transaction in progress, although you can ROLLBACK once the transaction is complete. Another feature of a transaction is that in SQL Server, every transaction is a named transaction; something that shows up in the BEGIN TRANSACTION command.
Given these requirements, the following commands cannot be part of a named transaction: ALTER DATABASE, BACKUP LOG, CREATE DATABASE, DROP DATABASE, DUMP TRANSACTION, DISK INIT, LOAD DATABASE, LOAD TRANSACTION, RECONFIGURE, RESTORE DATABASE, RESTORE LOG and UPDATE STATISTICS.
Barrie Sosinsky is president of consulting company Sosinsky and Associates (Medfield MA). He has written extensively on a variety of computer topics.
Disclaimer:
Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.
Join the conversationComment
Share
Comments
Results
Contribute to the conversation