Chapter 5. XQuery

The W3C defines the powerful XML Query (XQuery) language for querying XML data. SQL Server 2008 provides built-in support for XQuery via its xml data type methods. In this chapter, I will examine SQL Server's XQuery implementation and support, including keywords, syntax, and the XQuery/XPath Data Model (XDM). As always, I'll provide working examples to illustrate and highlight XQuery functionality along the way.

SQL Server implements XQuery through its xml data type methods: query(), value(), nodes(), exists(), and modify(). I introduced these methods in Chapter 3. I will begin this chapter with an introduction to the XQuery language and the XDM, finishing up with tips for maximizing SQL Server XQuery performance.

Introducing the ...

Get Pro SQL Server 2008 XML now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.