You need to produce the required output by querying the database without using system stored procedures

You are a database developer. You plan to create a database by using SQL Server 2008.
The database has a table named Employees. The table contains records of employees and
their managers. The table includes the EmployeelD and ManagerlD fields. The EmployeelD

values are unique. The value in the M anagerlD field is the employee I D of t he e mployee’s
m anager. A Web s ite r equires X ML formatted output of all managers and employees to
be displayed as a tree diagram. You need to produce the required output by querying the
database without using system stored procedures. What should you do?

You are a database developer. You plan to create a database by using SQL Server 2008.
The database has a table named Employees. The table contains records of employees and
their managers. The table includes the EmployeelD and ManagerlD fields. The EmployeelD

values are unique. The value in the M anagerlD field is the employee I D of t he e mployee’s
m anager. A Web s ite r equires X ML formatted output of all managers and employees to
be displayed as a tree diagram. You need to produce the required output by querying the
database without using system stored procedures. What should you do?

A.
Create a table-valued function by using the hierarchyid data type.

B.
Create a scalar-valued function by using the FOR XML PATH clause and the TYPE
directive.

C.
Create a scalar-valued function by using the OPENXML () function.

D.
Create a table-valued function by using a common table expression (CTE).



Leave a Reply 0

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