What is the result?

You are a database developer on an instance of SQL Server 2008. Your Personnel table is defined as follows:


The Personnel table has a primary key defined on the EmployeeID column and contains a table-level CHECK constraint that ensures that only the employee with an EmployeeID value of 1 may have a NULL value for the ManagerID column.
You execute the following Transact-SQL:
;WITH MyCTE
AS
(
SELECT EmployeeID, ManagerID, HireDate
FROM Personnel
WHERE ManagerID IS NULL
UNION ALL
SELECT p.EmployeeID, p.ManagerID, p.HireDate
FROM Personnel p INNER JOIN MyCTE m ON p.ManagerID = m.EmployeeID
)
SELECT * FROM MyCTEOPTION (MAXRECURSION 3);
What is the result?
A. The statement executes successfully with no errors and displays only three rows.
B. The statement fails because the CTE has not been defined as recursive.
C. The statement executes successfully with no errors and displays all employees, including each employee’s ManagerID and HireDate.
D. The statement generates an error message, but displays employees that are at the first four levels of the organization chart.

microsoft-exams

Leave a Reply

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


The reCAPTCHA verification period has expired. Please reload the page.