|
thisisfutile
Starting Member
USA
3 Posts |
Posted - 02/26/2006 : 13:32:25
|
The multi-statement example of this article shows two commands (Update and Update) in the TRAN and the corresponding explanation says:
If the statement fails after the first update, neither update statement will be applied when SQL Server is restarted. The log file will contain a BEGIN TRAN but no corresponding COMMIT TRAN.
(I assume this means the updates aren't applied to the database....allow me to continue in my confusion)
Then, further down the page the example for Create Proc has two commands (Insert and Update) and the first one fails on a primary key violation. However, the Update completes successfuly and is commited.
My confusion is that both TRANs have two commands. The 1st example says if either one fails the TRAN isn't committed. The 2nd example says the TRAN will commit the second command even though the first command fails. Is this because the TRAN in the 2nd example is part of a procedure? More directly, if the 1st example was put into the Create Proc like the 2nd example and the first update of that TRAN fails, will the second update NOW succeed and be commited? |
|