Microsoft
70-433 · Question #42
You have been tasked to delete 1000 rows from a table named NewWidgets. There are 2000 rows in which the column ToBeDeleted set to 1. You need to write a Transact-SQL batch that will delete exactly…
The correct answer is A. DELETE TOP (1000) dbo.NewWidgets. See the full explanation below for the reasoning.
Question
You have been tasked to delete 1000 rows from a table named NewWidgets. There are 2000 rows in which the column ToBeDeleted set to 1. You need to write a Transact-SQL batch that will delete exactly 1000 rows. Which Transact-SQL batch should you use?
Options
- ADELETE TOP (1000) dbo.NewWidgets
- BDECLARE @BatchSize INT = 10;
- CDELETE TOP ((SELECT COUNT(*) FROM dbo.NewWidgets
- DDECLARE @TotalRowCount INT = 0; WHILE (@TotalRowCount <= 1000)
How the community answered
(36 responses)- A75% (27)
- B6% (2)
- C6% (2)
- D14% (5)
Community Discussion
No community discussion yet for this question.