exam questions

Exam 70-762 All Questions

View all questions & answers for the 70-762 exam

Exam 70-762 topic 1 question 154 discussion

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

DRAG DROP -
You have a database that contains three encrypted store procedures named dbo.Proc1, dbo.Proc2 and dbo.Proc3. The stored procedures include INSERT,
UPDATE, and DELETE statements.
You have the following requirements:
✑ You must run all the stored procedures within the same transaction.
✑ You must automatically start a transaction when stored procedures include DML statements.
✑ You must not automatically start a transaction when stored procedures include DDL statements.
You need to run all three stored procedures.
Which three Transact-SQL segments should you use to develop the solution? To answer, move the appropriate Transact-SQL segments to the answer area and arrange then in the correct order.
Select and Place:

Show Suggested Answer Hide Answer
Suggested Answer: Explanation
Step 1: SET IMPLICIT_TRANSACTIONS ON BEGIN TRAN
When ON, the system is in implicit transaction mode. This means that if @@TRANCOUNT = 0, any of the following Transact-SQL statements begins a new transaction. It is equivalent to an unseen BEGIN TRANSACTION being executed first:

Step 2:
Run the procedure within the same transaction
Step 3:

Commit the transaction -
References:
https://docs.microsoft.com/en-us/sql/t-sql/statements/set-implicit-transactions-transact-sql

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
Lukis92
Highly Voted 4 years, 8 months ago
SET IMPLICIT_TRANSACTION ON -------------------------------------------------------- BEGIN TRY EXEC dbo.Proc1 EXEC dbo.Proc2 EXEC dbo.Proc3 IF (XACT_STATE() = 1) COMMIT TRANSACTION; END TRY -------------------------------------------------------- BEGIN CATCH IF (XACT_STATE() != 0) ROLLBACK TRANSACTION -------------------------------------------------------- SET IMPLICIT_TRANSACTION OFF
upvoted 13 times
...
kimalto452
Most Recent 4 years, 4 months ago
https://www.briefmenow.org/microsoft/which-four-transact-sql-segments-should-you-use-to-deve/
upvoted 2 times
...
gog33
4 years, 5 months ago
To start transaction with implist must be Begin Tran command
upvoted 1 times
Andy7622
4 years, 3 months ago
No, Nooo
upvoted 1 times
...
Andy7622
4 years, 3 months ago
You start transaction with BEGIN TRAN explicitly
upvoted 2 times
...
...
Anette
4 years, 10 months ago
Question is the same with Q16, but there are required 4 Transact-SQL segments not 3, so, I am not sure about the segments here :/
upvoted 1 times
...
HPLovesCrafts
4 years, 11 months ago
The answers from which to choose are not visible. Like this, the Question doesn't really help.
upvoted 2 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 ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago