

PATH: You can enjoy the flexibility of the EXPLICIT mode in an easier way with the PATH mode and the nested FOR XML query capability.With this mode, you have more control over the shape of the XML. Explicit: The EXPLICIT mode enables you to mix the attributes and elements, create wrappers, and more as you like.AUTO: According to the way the SELECT statement is specified, the AUTO mode creates nesting in the resulting XML.It only creates a single row element per row in the rowset that is output by the SELECT statement. RAW: The RAW mode is the simplest one among the four.When you use a FOR XML clause, you need to specify one of the four modes: RAW, AUTO, EXPLICIT, and PATH.

It can be used both in top-level queries (SELECT statement) and in subqueries (INSERT, UPDATE, and DELETE statements). With the FOR XML clause, you can save the result of a SQL query as XML. Given that, many users want to save the SQL query result to XML or export the SQL database to the XML file. XML stores data in plain text format, which indicates the simplicity, usability, and generality of this format. XML, Extensible Markup Language, is a markup language which defines a set of rules for encoding documents in a format that can be read by both human and machine.
