What is the result of each Transact-SQL statement?

Posted by: Pdfprep Category: 70-761 Tags: , ,

HOTSPOT

You have the following stored procedure:

You run the following Transact-SQL statements:

What is the result of each Transact-SQL statement? To answer, select the appropriate options in the answer area.

Answer:

Explanation:

Box 1: All transactions are rolled back.

The first IF-statement, IF @CODE = ‘C2323’ AND @ApplicationID = 1, will be true, an error will be raised, the error will be caught in the CATCH block, and the only transaction that has been started will be rolled back.

Box 2: All transactions are rolled back.

When nesting transactions, this same statement rolls back all inner transactions to the outermost BEGIN TRANSACTION statement.

References: https://docs.microsoft.com/en-us/sql/t-sql/language-elements/rollback-transaction-transact-sql

Leave a Reply

Your email address will not be published.