Q&A

Q1:Can I turn off transaction management for a while?
A1: No.
Q2:Is there real stuff I can look at to help me understand transactions? Can I read log records? Can I see a BEGIN TRAN or COMMIT TRAN marker?
A2: There are methods of dumping pages from the log to examine them, but I won't go into them here. These are advanced methods, and they can cause some disruption or corruption of your database. When you need to know that stuff, Microsoft tech support can walk you through it.
Q3:You said that every SQL statement is a transaction itself. Does the server use a different mechanism for those transactions from the way that my explicit transactions are performed?
A3: No. Every statement, whether within an explicit transaction or not, includes an implied BEGIN TRANSACTIONS and COMMIT TRANACTIONS. On Day 17, "Debugging Stored Procedures," when we look at triggers, we will examine the value of @@trancount while we are running the trigger. You'll see that @@trancount is automatically incremented at the start of every SQL statement (by the implied BEGIN TRANSACTIONS ) and decremented at the end (by the implied COMMIT TRANSACTIONS ).
Q4:When should I use implicit transactions?
A4: Implicit transactions are particularly useful when you are porting SQL code from another database environment when the default is to use implicit transactions. Instead of rewriting every single query to remove extra COMMIT statements, you simply set the IMPLICIT TRANSACTIONS option in each session and run it.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset