Microsoft
70-433 · Question #79
You need to determine the result of executing this code segment. DECLARE @RangeStart INT = 0; DECLARE @RangeEnd INT = 10000; DECLARE @RangeStep INT = 1; WITH NumberRange(ItemValue) AS ( SELECT…
The correct answer is C. 101 rows will be returned with a maximum recursion error. See the full explanation below for the reasoning.
Question
You need to determine the result of executing this code segment. DECLARE @RangeStart INT = 0; DECLARE @RangeEnd INT = 10000; DECLARE @RangeStep INT = 1; WITH NumberRange(ItemValue) AS ( SELECT ItemValue FROM (SELECT @RangeStart AS ItemValue) AS t UNION ALL SELECT ItemValue + @RangeStep FROM NumberRange WHERE ItemValue < @RangeEnd) SELECT ItemValue FROM NumberRange OPTION (MAXRECURSION 100) Which result will be returned?
Options
- A101 rows will be returned with no error.
- B10,001 rows will be returned with no error.
- C101 rows will be returned with a maximum recursion error.
- D10,001 rows will be returned with a maximum recursion error.
How the community answered
(45 responses)- A9% (4)
- B2% (1)
- C73% (33)
- D16% (7)
Community Discussion
No community discussion yet for this question.