The Built-in xml Data Type Methods

Now that you know how to create and manage typed and untyped xml columns, the next step is to learn how to query and modify stored XML content. Although SQL Server supports only a subset of the XQuery 1.0 recommendation, you’ll soon see that it’s plenty to get the job done.

Keep in mind that a mastery of XQuery is not a requirement for selecting out XML data; you can just specify the name of the xml column to select all the data back at once.

SQL Server provides five built-in methods on the xml data type: query(), exist(), value(), nodes(), and modify(). These methods are appended to the name of the xml column in question, using the ColumnName.MethodName([MethodParameters]) syntax. These methods work on XML ...

Get Microsoft® SQL Server 2012 Unleashed 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.