Home > OS >  How can a session detect if it's running with XACT_ABORT turned on?
How can a session detect if it's running with XACT_ABORT turned on?

Time:05-16

We plan to globally enable XACT_ABORT on our databases using sp_configure. However, I would like to be able to make the services that use SQL Server be able to test that the database they are using is correctly configured, because it's an easy thing to get wrong that won't necessarily show up in logs until it's way too late. Is there a piece of a code that a low-privilege user could run that would produce an unambiguous answer without making modifications to existing database tables?

CodePudding user response:

From the documentation, to determine the current setting you can test bit 14 of @@options

if (16384 & @@options) = 16384 
  print 'xact abort is on'
  • Related