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 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.