Save Points
SQL Server does not support a true sense of nested transactions. When you issue a ROLLBACK TRAN command within a transaction, SQL Server rolls back all activity performed as of the outermost BEGIN TRAN. If you issue a BEGIN TRAN statement within an existing transaction, you don’t really open a new transaction. Rather, SQL Server simply increments an internal counter that you can query via the @@trancount function. A COMMIT TRAN statement decrements the counter by one, and only the outermost COMMIT TRAN, which decrements the counter to zero, really commits the transaction. SQL Server will limit the number of levels you can open with BEGIN TRAN statements to 32.
SQL Server supports save points, which allow you to undo some partial activity ...
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