Retrieving XML Documents Using FOR XML

XML and Internet Support

XML and Internet Support

Retrieving XML Documents Using FOR XML

You can execute SQL queries against existing relational databases to return results as XML documents rather than as standard rowsets. To retrieve results directly, use the FOR XML clause of the SELECT statement, and within the FOR XML clause, specify one of these XML modes:

  • RAW

  • AUTO

  • EXPLICIT

These modes are in effect only for the execution of the query for which they are set. They do not affect the results of any subsequent queries. In addition to specifying the XML mode, you can also request the XML-Data schema.

See Also

Executing Template Files Using a URL

SELECT