XML in SQL Server 2008—the xml Data Type

SQL Server 2005 introduced a new data type, xml, for working with XML data, and SQL Server 2008 further enhances it. Using this new data type, you can store XML in its native format, query the data within the XML, efficiently and easily modify data within the XML without having to replace the entire contents, and index the data in the XML. You can use xml as any of the following:

  • A variable

  • A parameter in a stored procedure or a user-defined function (UDF)

  • A return value from a UDF

  • A column in a table

There are some limitations of the xml data type that you should be aware of. Although this data type can contain and be checked for null values, unlike other native types, you cannot directly compare an instance ...

Get Programming Microsoft® SQL Server™ 2008 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.