Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««23456

Transactions 2 Expand / Collapse
Author
Message
Posted Thursday, May 24, 2012 3:25 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, November 18, 2014 7:01 AM
Points: 968, Visits: 1,170
Nice question i got it correct,i encountered a similar experience.I liked the explanation learned something.thank you.

“When I hear somebody sigh, ‘Life is hard,’ I am always tempted to ask, ‘Compared to what?’” - Sydney Harris
Post #1305632
Posted Thursday, May 24, 2012 6:07 AM


Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Yesterday @ 12:09 PM
Points: 717, Visits: 3,033
ralph.bacon (5/24/2012)
rmechaber (5/23/2012)
...I found this write-up useful in explaining the benefits -- and issues -- related to XACT_ABORT and TRY..CATCH: http://www.simple-talk.com/sql/t-sql-programming/defensive-error-handling/.

For example, there's a nice demonstration of how XACT_STATE() is needed to catch uncommittable transactions, following something as simple as a failed type conversion from string to integer [SELECT CAST('abc' AS INTEGER)].

Rich

An excellent article, that should be compulsory reading for all us SQL developers!

Thanks for posting Rich.

YW, thanks for letting me know you found it useful!
Rich
Post #1305754
Posted Thursday, May 24, 2012 11:16 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, November 14, 2014 3:41 PM
Points: 354, Visits: 107
Great question! You'd be surprised to know how many SQL developers think if any error is encountered within a transaction it automatically gets rolled back like when XACT_ABORT is on.
Post #1306026
Posted Thursday, May 24, 2012 7:38 PM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Sunday, April 27, 2014 7:45 PM
Points: 1,589, Visits: 253
I got it right for the wrong reason. Learned something. Thanks for submitting.

http://brittcluff.blogspot.com/
Post #1306268
Posted Thursday, August 9, 2012 9:00 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Monday, April 15, 2013 11:42 PM
Points: 424, Visits: 55
Good question.
Post #1342730
Posted Monday, October 8, 2012 12:50 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Yesterday @ 2:51 AM
Points: 1,938, Visits: 2,372
wrong answer

I learned a lot from transaction questions :)



_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #1369630
Posted Wednesday, January 9, 2013 5:06 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, November 18, 2014 5:30 AM
Points: 971, Visits: 564
I answered 1 row.

Assuming violation is at second row so first row will be xcuted succesffully. One more thing i didn't notice that all three insert statements are inside a transaction.

But if it is implict transaction and set xact_abort is ON
Then first row will be inserted sucessfully..


--
Dineshbabu
Desire to learn new things..
Post #1404697
« Prev Topic | Next Topic »

Add to briefcase «««23456

Permissions Expand / Collapse