PrepAway - Latest Free Exam Questions & Answers

Which code segment should you add to line 14?

You use Microsoft SQL Server 2012 to create a stored procedure as shown in the following
code segment. (Line numbers are included for reference only.)

The procedure can be called within other transactions.
You need to ensure that when the DELETE statement from the
HumanResourcesJobCandidate table succeeds, the modification is retained even if the
insert into the Audit.Log table fails.
Which code segment should you add to line 14?

PrepAway - Latest Free Exam Questions & Answers

A.
IF @@TRANCOUNT = 0

B.
IF (XACT_STATE ( ) ) = 0

C.
IF (XACT_STATE ( ) ) = 1

D.
IF @@TRANCOUNT = l

Explanation:
Reference:
http://msdn.microsoft.com/en-us/library/ms189797.aspx
Reference:
http://msdn.microsoft.com/en-us/library/ms187967.aspx

One Comment on “Which code segment should you add to line 14?

  1. Minion says:

    In brief,

    @@TRANCOUNT tells you the number of BEGIN TRANSACTION(s) statement above it.

    XACT_STATE() – 0 means that you cannot commit or roll back because there’s nothing to commit or roll back. 1 means that the transaction is committable. -1 means that the transaction is uncommittable.




    0



    0

Leave a Reply