Chapter 14

Using XML Data

In This Chapter

Understanding The XML Data Type

Using The XML Data Type Methods

Working With The FOR XML Clause

Understanding XQuery And FLOWR Operations

The ability to process XML in SQL Server began with SQL Server 2000. Since then, many wonderful and significant changes and enhancements have been added to SQL Server to make working with and processing XML easier and more efficient.

With SQL Server 2005, Microsoft added the XML data type and other great XML features, such as support for XML data type methods and using XML as a variable and parameter. SQL Server 2008 and SQL Server 2008 R2 added even more support, such as support for the let clause of the FLWOR operations.

Although there haven't been any major enhancements to XML in Denali, working with XML is and always will be crucial in nearly every environment. It should be obvious that Microsoft is embracing XML all the way because you can see XML used in nearly every aspect. For example, SQL Server Reporting Services report definitions are actually just XML documents. SQL Server Integration Services packages are XML documents and support XML configuration files. And there is a lot more.

This chapter covers some of the major areas to work with XML, including the XML data type in both column form and variable form. It also talks about the methods used to query XML, and follows that up by discussing the FOR XML clause, which is used to turn tabular data into many different formats of XML. The chapter ...

Get Microsoft SQL Server 2012 Bible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.