You work as the database administrator at Domain.com. The Domain.com network consists of a single Active Directory domain named Domain.com. All servers on the Domain.com network run Windows Server 2003. The Domain.com network contains a SQL Server 2005 database server named Certkiller -DB01. Certkiller -DB01 contains a database named CK_Sales. The tables in the CK_Sales database are shown in the database diagram.
Kara Lang is the manager of the Sales department. Kara Lang wants a report that indicates the performance of each sales person in the Sales department. She asks you to produce the report based on the SalesPersons and Invoices tables. The report must be presented in XML format.
What should you do?
A.
Run the query with the FOR XML clause.
B.
Run the query with the OPENXML statement.
C.
Use XQuery to query the CK_Sales database.
D.
Use XML DML to query the CK_Sales database.
Explanation:
You can use the FOR XML clause in the SELECT statement to have the result set of a query returned in XML format rather than as table rows.
Incorrect Answers:
B, C: The OPENXML statement and XQuery can be used to query an XML document.
It cannot used to query a SQL database.
D: XML DML can be used to perform insert, delete and update operations on an XML document. It is not used to query a SQL database.
Reference:
Microsoft SQL Server 2005 Books Online (2006), Index: XML [SQL Server], FOR XML clause
Microsoft SQL Server 2005 Books Online (2006), Index: XML [SQL Server], OPENXML statement
Microsoft SQL Server 2005 Books Online (2006), Index: XML [SQL Server], XQuery Microsoft SQL Server 2005 Books Online (2006), Index: XML [SQL Server], DML