Which TransactSQL statement should you insert at line 07?

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 TransactSQL
statement that will notify you immediately after each batch of rows is
deleted. Which TransactSQL
statement should you insert at line 07?

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 TransactSQL
statement that will notify you immediately after each batch of rows is
deleted. Which TransactSQL
statement should you insert at line 07?

A.
RAISERROR (‘Deleted %i rows’, 6, 1, @RowCount)

B.
RAISERROR (‘Deleted %i rows’, 16, 1, @RowCount)

C.
RAISERROR (‘Deleted %i rows’, 10, 1, @RowCount) WITH NOWAIT

D.
RAISERROR (‘Deleted %i rows’, 11, 1, @RowCount) WITH NOWAIT



Leave a Reply 0

Your email address will not be published. Required fields are marked *