Chapter 10. Introduction to XQuery on SQL Server
Starting with SQL Server 2005, Microsoft added built-in support for XML Query Language (XQuery). XQuery allows you to query your XML (Extensible Markup Language) data using a simple, yet powerful, path-style syntax. XQuery support makes it easy to
- Retrieve XML elements from XML content
- Extract scalar values from XML data
- Check for the existence of elements or values in XML data
- Modify your XML data via XML Data Manipulation Language (XML DML) extensions
SQL Server 2008 includes XQuery support with some slight improvements over the SQL Server 2005 release. This chapter is designed as an introduction to the XQuery functionality available in SQL Server. In this chapter we will assume little or no knowledge of XQuery in general.
XQuery is the XML Query Language, as defined by the World Wide Web Consortium (W3C) Recommendation at http://www.w3.org/TR/xquery/. The XQuery recommendation provides the syntax and semantics for a language for querying XML data. XML is a markup language that allows the creation of custom markup languages. SQL Server provides support for XQuery via the xml data type methods, listed in table 1.