Click to Rate and Give Feedback
MSDN
MSDN Library
SQL Server
SQL Server 2008
Database Engine
Technical Reference
xml (Transact-SQL)

  Switch on low bandwidth view
Community Content
In this section
Statistics Annotations (9)
Other versions are also available for the following:
SQL Server 2008 Books Online (June 2009)
xml (Transact-SQL)

Is the data type that stores XML data. You can store xml instances in a column, or a variable of xml type. For more information, see Implementing XML in SQL Server.

Topic link icon Transact-SQL Syntax Conventions

xml ( [ CONTENT | DOCUMENT ] xml_schema_collection )
CONTENT

Restricts the xml instance to be a well-formed XML fragment. The XML data can contain multiple zero or more elements at the top level. Text nodes are also allowed at the top level.

This is the default behavior.

DOCUMENT

Restricts the xml instance to be a well-formed XML document. The XML data must have one and only one root element. Text nodes are not allowed at the top level.

xml_schema_collection

Is the name of an XML schema collection. To create a typed xml column or variable, you can optionally specify the XML schema collection name. For more information about typed and untyped XML, see Typed XML Compared to Untyped XML.

The stored representation of xml data type instances cannot exceed 2 gigabytes (GB) in size. For more information, see Implementing XML in SQL Server.

The CONTENT and DOCUMENT facets apply only to typed XML. For more information see Typed XML Compared to Untyped XML.

USE AdventureWorks;
GO
DECLARE @y xml (Sales.IndividualSurveySchemaCollection)
SET @y =  (SELECT TOP 1 Demographics FROM Sales.Individual);
SELECT @y;
GO
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker