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: Yesterday @ 6:47 AM
Points: 934, Visits: 1,153
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


Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Wednesday, April 09, 2014 8:22 AM
Points: 685, Visits: 2,992
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: Today @ 11:01 AM
Points: 350, Visits: 99
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: Wednesday, October 24, 2012 8:17 PM
Points: 1,588, Visits: 247
I got it right for the wrong reason. Learned something. Thanks for submitting.

http://brittcluff.blogspot.com/
Post #1306268
Posted Thursday, August 09, 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 08, 2012 12:50 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Monday, April 14, 2014 11:50 PM
Points: 1,867, Visits: 2,275
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 09, 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: Yesterday @ 5:16 AM
Points: 905, Visits: 553
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