Microsoft
70-451 · Question #22
You are a database developer. You plan to design a database solution by using SQL Server 2008. You create a stored procedure that uses the TRY/CATCH syntax in a new database. When the stored…
The correct answer is D. 1. Define a table variable before the TRY block by using the same columns as that of the. See the full explanation below for the reasoning.
Question
You are a database developer. You plan to design a database solution by using SQL Server 2008. You create a stored procedure that uses the TRY/CATCH syntax in a new database. When the stored procedure is executed, it logs information about each step in the TRY block into a table named dbo.ExecutionLog. When an error occurs, the stored procedure must perform the following tasks:
- Roll back the changes made to the target tables.
- Retain the log entries stored in the dbo.ExecutionLog table.
You need to ensure that the stored procedure performs the given tasks. What should you do?
Options
- A1.Start a transaction in the TRY block.
- B
- Start a transaction in the TRY block.
- C
- Define a temporary table before the TRY block by using the same columns as that of the
- D
- Define a table variable before the TRY block by using the same columns as that of the
How the community answered
(39 responses)- A8% (3)
- B3% (1)
- C5% (2)
- D85% (33)
Community Discussion
No community discussion yet for this question.