70-465 · Question #65
You need to recommend a change to USP_3 to ensure that the procedure continues to execute even if one of the UPDATE statements fails. Which change should you recommend?
The correct answer is A. Set the XACT_ABORT option to off.. This question tests knowledge of SQL Server session options that control transaction behavior when a runtime error occurs. Specifically, XACT_ABORT determines whether a transaction is automatically rolled back when a statement error occurs.
Question
Options
- ASet the XACT_ABORT option to off.
- BSet the XACT_ABORT option to on.
- CSet the IMPLICIT_TRANSACTIONS option to off.
- DSet the IMPLICIT_TRANSACTIONS option to on.
How the community answered
(30 responses)- A73% (22)
- B7% (2)
- C17% (5)
- D3% (1)
Why each option
This question tests knowledge of SQL Server session options that control transaction behavior when a runtime error occurs. Specifically, XACT_ABORT determines whether a transaction is automatically rolled back when a statement error occurs.
When XACT_ABORT is OFF (the default), SQL Server only rolls back the individual statement that caused the error, allowing the stored procedure to continue executing subsequent statements. This means if one UPDATE fails, the procedure will handle the error at that statement level and proceed to the next UPDATE rather than terminating the entire batch or transaction.
Setting XACT_ABORT to ON causes SQL Server to automatically roll back the entire current transaction and terminate the batch whenever a run-time error occurs, which would stop execution of the procedure rather than allowing it to continue after a failed UPDATE.
IMPLICIT_TRANSACTIONS OFF means each statement runs in autocommit mode unless explicitly wrapped in a transaction, which does not directly address whether the procedure continues executing after an individual UPDATE statement fails.
Setting IMPLICIT_TRANSACTIONS to ON causes SQL Server to automatically start a transaction for DML statements, but this does not allow the procedure to continue executing after a failed UPDATE; it controls transaction scope, not error-continuation behavior.
Concept tested: SQL Server XACT_ABORT session option error handling
Source: https://learn.microsoft.com/en-us/sql/t-sql/statements/set-xact-abort-transact-sql
Topics
Community Discussion
No community discussion yet for this question.