nerdexam
Microsoft

70-465 · Question #117

You use SQL Server 2014 to maintain the data used by applications at your company. You want to execute two statements. You need to guarantee that either both statements succeed, or both statements…

The correct answer is D. Option D. This question tests the use of explicit transactions in T-SQL to ensure atomicity - guaranteeing that multiple statements either all succeed or all fail together.

Submitted by kim_seoul· Mar 5, 2026Design and implement database solutions for SQL Server

Question

You use SQL Server 2014 to maintain the data used by applications at your company. You want to execute two statements. You need to guarantee that either both statements succeed, or both statements fail together as a batch. Which code should you use?

Exhibit

70-465 question #117 exhibit

Options

  • AOption A
  • BOption B
  • COption C
  • DOption D
  • EOption E

How the community answered

(32 responses)
  • A
    3% (1)
  • B
    6% (2)
  • D
    88% (28)
  • E
    3% (1)

Why each option

This question tests the use of explicit transactions in T-SQL to ensure atomicity - guaranteeing that multiple statements either all succeed or all fail together.

AOption A

Option A likely executes the statements without any transaction control, meaning each statement commits independently and a failure of one does not roll back the other.

BOption B

Option B likely uses an incomplete or incorrect transaction structure, such as missing a ROLLBACK in an error-handling path, which does not guarantee atomicity on failure.

COption C

Option C likely uses a TRY/CATCH without proper BEGIN/COMMIT/ROLLBACK transaction statements, so SQL Server cannot treat both statements as a single atomic unit.

DOption DCorrect

Option D uses an explicit transaction with BEGIN TRANSACTION, a TRY/CATCH block, COMMIT TRANSACTION on success, and ROLLBACK TRANSACTION on failure. This pattern guarantees atomicity by wrapping both statements in a single logical unit of work, ensuring that if either statement fails, the CATCH block triggers a ROLLBACK and neither change is persisted to the database.

EOption E

Option E likely uses SET XACT_ABORT or another partial mechanism that does not fully implement explicit transaction control with both COMMIT and ROLLBACK paths required for guaranteed atomicity.

Concept tested: T-SQL explicit transactions with TRY/CATCH atomicity

Source: https://learn.microsoft.com/en-us/sql/t-sql/language-elements/try-catch-transact-sql

Topics

#Transactions#Atomicity#T-SQL

Community Discussion

No community discussion yet for this question.

Full 70-465 Practice