What is the use of FOR XML in SQL Server? - XML

What is the use of FOR XML in SQL Server?

SQL Server is having a fantastic feature to retrieve data persisted in the form of XML format. The data in the XML format can be retrieved using FOR XML clause appending to the SELECT statement.

There are 3 modes:

1. “FOR XML AUTO" : Returns XML elements that are nested, based on which tables are listed in the "from" part of the query, and which fields are listed in the "select" part.
2. "FOR XML RAW" : Returns XML elements with the "row" prefix (ex: ""). Each column in a table is represented as an attribute and null column values aren't included.
3. "FOR XML EXPLICIT" : Explicit mode is the most complex shaping method used in SQL Server 2000. It allows users to query a data source in such a way that the names and values of the returned XML are specified before the query batch is executed.
Difference between SAX parser and DOM parser - XML
SAX is developed especially for java programs. It implements a model that is memory resident.......
What is the difference between Schema and DTD? - XML
DTD supports two types of data – CDATA and PCDATA. Schema supports numeric, Boolean and String data types and suitable for applications.......
How do you parse/validate the XML document? - XML
Parsing the XML document is the only way to validate the XML file.......
Post your comment