70-433 · Question #104
You have a table named Orders. You have been tasked to modify your company's main database to remove all inactive order rows. You are developing a stored procedure that will enable you to delete…
The correct answer is C. RAISERROR ('Deleted %i rows', 10, 1, @RowCount) WITH NOWAIT. RAISERROR can be used as an alternative to PRINT to return messages to calling applications. Because RAISERROR run with a severity of 11 to 19 in a TRY block transfers control to the associated CATCH block, specify a severity of 10 or lower to use RAISERROR to return a message…
Question
You have a table named Orders. You have been tasked to modify your company's main database to remove all inactive order rows. You are developing a stored procedure that will enable you to delete these rows. You have written the following code segment to accomplish this task. (Line numbers are included for reference only.) 01 BEGIN TRY 02 DECLARE @RowCount INT = 1000 03 WHILE @RowCount = 1000 04 BEGIN 05 DELETE TOP (1000) FROM Orders WHERE Status = 'Inactive'; 06 SET @RowCount = @@ROWCOUNT 07 ... 08 END 09 END TRY 10 BEGIN CATCH 11 PRINT ERROR_MESSAGE() 12 END CATCH You need to insert a Transact-SQL statement that will notify you immediately after each batch of rows is deleted. Which Transact-SQL statement should you insert at line 07?
Options
- ARAISERROR ('Deleted %i rows', 6, 1, @RowCount)
- BRAISERROR ('Deleted %i rows', 16, 1, @RowCount)
- CRAISERROR ('Deleted %i rows', 10, 1, @RowCount) WITH NOWAIT
- DRAISERROR ('Deleted %i rows', 11, 1, @RowCount) WITH NOWAIT
How the community answered
(49 responses)- A4% (2)
- B2% (1)
- C82% (40)
- D12% (6)
Explanation
RAISERROR can be used as an alternative to PRINT to return messages to calling applications. Because RAISERROR run with a severity of 11 to 19 in a TRY block transfers control to the associated CATCH block, specify a severity of 10 or lower to use RAISERROR to return a message from a TRY block without invoking the CATCH block. NOWAIT option sends messages immediately to the client.
Topics
Community Discussion
No community discussion yet for this question.