The xml Data Type

Using the xml 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 to 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 of an xml data type to another instance of an xml data type. (You can, however, convert that instance to a text data type and then do a compare.) Any such ...

Get Programming Microsoft® SQL Server® 2012 now with O’Reilly online learning.

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