exam questions

Exam 70-761 All Questions

View all questions & answers for the 70-761 exam

Exam 70-761 topic 1 question 15 discussion

Actual exam question from Microsoft's 70-761
Question #: 15
Topic #: 1
[All 70-761 Questions]

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.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
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: Only Log1, Log2, and Log3 tables are updated.
The second IF-statement, IF @Code = 'C2323', will be true, so the second transaction will be rolled back, but log1, log2, and log3 was updated before the second transaction.

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Tazul
Highly Voted 5 years, 9 months ago
For both case, correct answer:All Transactions are Rolled Back Ref:"When nesting transactions, this same statement rolls back all inner transactions to the outermost BEGIN TRANSACTION statement. " https://docs.microsoft.com/en-us/sql/t-sql/language-elements/rollback-transaction-transact-sql?view=sql-server-2016
upvoted 33 times
Luzix
4 years, 6 months ago
Me too. For both case, correct answer:All Transactions are Rolled Back
upvoted 2 times
...
...
Tazul
Highly Voted 5 years, 9 months ago
I've tested the code as well
upvoted 12 times
M4x
5 years, 9 months ago
Me too. For both case, correct answer:All Transactions are Rolled Back
upvoted 22 times
...
...
Anirudh_net
Most Recent 3 years, 3 months ago
Agree - one rollback at any level of transaction stack rolls back everything. Both result in everything being rolled back. RAISERROR transfers control to CATCH block with XACT_STATE=1
upvoted 1 times
...
Vermonster
4 years, 5 months ago
Agree - one rollback at any level of transaction stack rolls back everything. Both result in everything being rolled back. RAISERROR transfers control to CATCH block with XACT_STATE=1
upvoted 1 times
...
Oooo
4 years, 9 months ago
100% the answer for both is : All transactions rolled back.(Tested)
upvoted 1 times
...
Anette
5 years, 1 month ago
All of you are cporrec, I executed and for both executions the answer is: All Transactions are Rolled Back
upvoted 3 times
...
daniel_yes23
5 years, 2 months ago
The right answer is All of the transaction are rolled back.
upvoted 2 times
...
tcroots19
5 years, 3 months ago
Question here, I changed the IF @Code = 'C2323' --ROLLBACK TRAN to COMMIT TRAN It actually changes my @@TRANCOUNT from 2 -> 0, I would have expected 1 and it to not actually commit b/c in a nested TRAN
upvoted 1 times
...
moehijawe
5 years, 5 months ago
correct answer for both : All Transactions are Rolled Back
upvoted 9 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...