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
 SQL Server 2012 Forums
 Transact-SQL (2012)
 SET XACT_ABORT ON

Author  Topic 

sz1
Aged Yak Warrior

555 Posts

Posted - 2013-09-18 : 06:02:56
Are people using this no instead of ROLLBACK TRAN, will this rollback everything if any errors at all.


Set XACT_ABORT ON
code...
Set XACT_ABORT OFF

sigmas
Posting Yak Master

172 Posts

Posted - 2013-09-18 : 06:10:17
"Primary key v Constraint Primary Key"


Both example DDL are same. one of is column_constraint and the other is table_constraint.
Go to Top of Page

sz1
Aged Yak Warrior

555 Posts

Posted - 2013-09-18 : 06:35:24
What you on about? must have copied and saved by mistake if you seen something else but thanks for the info...someone asked me about constraints a while back...?

SZ1
Please help me to enable me to help others!
Go to Top of Page

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-09-18 : 10:44:19
quote:
Originally posted by sz1

Are people using this no instead of ROLLBACK TRAN, will this rollback everything if any errors at all.


Set XACT_ABORT ON
code...
Set XACT_ABORT OFF

Not quite, I think. Take a look at example C on this page. http://technet.microsoft.com/en-us/library/ms175976.aspx

Some transactions are committable even if there is an error, some are not. Setting XACT_ABORT ON and examining XACT_STATE lets you determine whether it is committable or not and take appropriate action.
Go to Top of Page
   

- Advertisement -