June 17, 2013 at 8:02 am
SQL Server allows the nesting of transactions. Like:
BEGIN TRAN
BEGIN TRAN
code...
COMMIT TRAN
BEGIN TRAN
code...
COMMIT TRAN
COMMIT TRAN
But is it really required the nesting of transaction, as we can do all transaction in a single BEGIN...COMMIT TRAN?
June 17, 2013 at 8:08 am
T.Ashish (6/17/2013)
SQL Server allows the nesting of transactions. Like:BEGIN TRAN
BEGIN TRAN
code...
COMMIT TRAN
BEGIN TRAN
code...
COMMIT TRAN
COMMIT TRAN
But is it really required the nesting of transaction, as we can do all transaction in a single BEGIN...COMMIT TRAN?
Nested transactions are a fallacy. They are simply not true. The sql engine allows what appears to be nested transactions so that multiple processes that begin a transaction will not fail. After the first begin transaction if there is a second begin it ONLY updates the transaction count.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
June 17, 2013 at 8:52 am
+1 to what Sean said.
Don't use them, and don't depend on them.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply