Using FOR XML EXPLICIT

FOR XML EXPLICIT allows you to control the structure of the XML document returned by the query. The query must be written in a particular way so that information about the nesting you want is specified within the query result. The optional directives supported by FOR XML EXPLICIT allow you to configure the treatment of individual columns. For example, you can control whether a column appears as element or attribute content, or whether a column is used only to order the result, rather than appearing in the generated XML.

For an example of how to write a query using FOR XML EXPLICIT, see Writing an EXPLICIT mode query.

 Parameters
 Adding data columns to the query
 Usage
 Writing an EXPLICIT mode query
 FOR XML EXPLICIT examples
 Using the element directive
 Using the hide directive
 Using the xml directive
 Using the cdata directive