Which code should you use?

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?

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?

A.
Option A

B.
Option B

C.
Option C

D.
Option D

E.
Option E

Explanation:
Structure should be:
BEGIN TRY
BEGIN TRANSACTION
COMMIT TRANSACTION
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION
END CATCH.
TRY…CATCH (Transact-SQL)



Leave a Reply 0

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