9.7. Working with a SQL Server XML Data Type Column

Problem

You need to store an XML document to an xml data type in SQL Server and subsequently retrieve that data as an XML document.

Solution

Example 9-12 shows the T-SQL statement that creates the table TableWithXmlDataType used in this solution.

Example 9-12. T-SQL statement: Create table TableWithXmlDataType

USE AdoDotNet35Cookbook
GO
CREATE TABLE TableWithXmlDataType(
    Id int NOT NULL PRIMARY KEY,
...