Microsoft® SQL Server 2008 R2 Unleashed
by Ray Rankins, Paul Bertucci, Chris Gallelli, Alex T. Silverstein
Transactions and Batches
There is no inherent transactional quality to batches. As you have seen already, unless you provide the syntax to define a single transaction made up of several statements, each individual statement in a batch is its own separate transaction, and each statement is carried to completion or fails individually.
The failure of a transaction within a batch does not cause the batch to stop processing. In other words, transaction flow does not affect process flow. After a ROLLBACK TRAN statement, processing continues with the next statement in the batch or stored procedure. For this reason, you should be sure to check for error conditions after each data modification within a transaction and exit the batch or stored procedure, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access