Home > Articles > Data > SQL Server

  • Print
  • + Share This
Like this article? We recommend

Like this article? We recommend

Transact-SQL XML Extensions

Transact-SQL allows you to present SQL Server data in XML format to the end user or the application that calls a stored procedure. In addition, it allows you to parse an XML document and treat it as relational data. Retrieving data in XML is accomplished with the FOR XML extension of the SELECT statement. The FOR XML extension, in turn has three modes: AUTO, RAW, and EXPLICIT. Each mode supports various options that let you customize your queries' output.

Reading and parsing the XML data is accomplished through the OPENXML() function, which also has a number of options.

In this article, I'll be discussing the AUTO and RAW modes of FOR XML only. (The EXPLICIT mode and the OPENXML() function are discussed in other articles in this series.)

  • + Share This
  • 🔖 Save To Your Account