Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Site Related Forums
 Article Discussion
 Clarify this for me please...

Author  Topic 

thisisfutile
Starting Member

3 Posts

Posted - 2006-02-26 : 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?

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2006-02-26 : 13:40:11
what article are you referring to?



-ec
Go to Top of Page

thisisfutile
Starting Member

3 Posts

Posted - 2006-02-26 : 13:50:23
Oops.

I read the [url=http://www.sqlteam.com/item.asp?ItemID=15583]Introduction to Transactions article [/url] and clicked comments. Then I clicked New Topic thinking it will still relate it to that article. Apparently that's not the case.

I'll repost my question at the "Comments" link for that article.

Perhaps SQL Team can disable/delete this thread.

Sorry,
Gabe
Go to Top of Page
   

- Advertisement -