EXPLICIT Mode
FOR XML EXPLICIT
is a powerful, oft-maligned, somewhat daunting mode of SQL Server XML production. It allows for the shaping of row data in any desirable XML structure, but the SQL required to produce it can easily end up being hundreds (or, in some cases, thousands) of lines long, leading to a potential maintenance headache.
With EXPLICIT
mode, the query author is responsible for making sure the XML is well formed and that the rowset generated behind the scenes corresponds to a very particular format.
The FOR XML PATH
statement renders FOR XML EXPLICIT
obsolete except when you need to output column values as CDATA
. This section therefore briefly covers the required query structure for and provides an example of this particular ...
Get Microsoft® SQL Server 2012 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.