exam questions

Exam 70-461 All Questions

View all questions & answers for the 70-461 exam

Exam 70-461 topic 1 question 155 discussion

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

DRAG DROP -
You use Microsoft SQL Server to develop a database application.
You create a stored procedure named usp_calculategrowth. The stored procedure modifies rows and can result in several different exceptions.
You need to ensure that when the stored procedure is executed, the following requirements are met:
✑ The calling application can receive a custom error message.
✑ The error is readable from the Windows Event Viewer of the server.
✑ The error isreadable in the SQL Error log.
Which six Transact-SQL segments should you use? To answer, move the appropriate Transact-SQL segments from the list of Transact-SQL segments to the answer area and arrange them in the correct order.
Select and Place:

Show Suggested Answer Hide Answer
Suggested Answer:
Box 1: BEGIN TRY -
A TRY"¦CATCH construct consists of two parts: a TRY block and a CATCH block. When an error condition is detected in a Transact-SQL statement that is inside a TRY block, control is passed to a CATCH block where the error can be processed.
A TRY blockstarts with the BEGIN TRY statement and ends with the END TRY statement.

Box 2: Exec usp_calculategrowth -

Box 3: END TRY -

Box 4: BEGIN CATCH -
A TRY block must be followed immediately by a CATCH block. A CATCH block starts with the BEGIN CATCH statement andends with the END CATCH statement.
Box 5: EXEC xp_logevent "¦
xp_logevent logs a user-defined message in the SQL Server log file and in the Windows Event Viewer. xp_logevent can be used to send an alert without sending a message to the client.
Incorrect:
Not RAISERROR: RAISERROR generates an error message and initiates error processing for the session.
The message is returned as a server error message to the calling application or to an associated CATCH block of a TRY"¦CATCH construct. New applicationsshould use THROW instead.

Box 6: END CATCH -
References:
https://msdn.microsoft.com/en-us/library/ms186244.aspx
https://technet.microsoft.com/en-us/library/ms179296(v=sql.105).aspx

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
lilupv
4 years, 10 months ago
I think, it is RAISEERROR
upvoted 1 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 ...