Which Transact-SQL statement should you include at the beginning of the stored procedure?

You create a stored procedure that will update multiple tables within a transaction.
You need to ensure that if the stored procedure raises a run-time error, the entire transaction is
terminated and rolled back.
Which Transact-SQL statement should you include at the beginning of the stored procedure?

You create a stored procedure that will update multiple tables within a transaction.
You need to ensure that if the stored procedure raises a run-time error, the entire transaction is
terminated and rolled back.
Which Transact-SQL statement should you include at the beginning of the stored procedure?

A.
SET XACT_ABORT ON

B.
SET ARITHABORT ON

C.
TRY

D.
BEGIN

E.
SET ARITHABORT OFF

F.
SET XACT_ABORT OFF

Explanation:
http://msdn.microsoft.com/en-us/library/ms190306.aspx
http://msdn.microsoft.com/en-us/library/ms188792.aspx



Leave a Reply 4

Your email address will not be published. Required fields are marked *


Bob

Bob

A.
SET XACT_ABORT ON – When SET XACT_ABORT is ON, if a Transact-SQL statement raises a run-time error, the entire transaction is terminated and rolled back.

salim

salim

answer is A.SET XACT_ABORT ON