The following limitations apply to the xml data type:
CREATE TABLE T1 (Col1 int primary key, Col2 xml) GO INSERT INTO T1 values (1, '<?xml version="1.0" encoding="windows-1252" ?><doc></doc>') GO SELECT Col2 FROM T1
<doc/>
DECLARE @x xml SET @x = '<root> <child/> </root>' SELECT @x
<root><child/></root>
SELECT CONVERT(xml, N'<root> <child/> </root>', 1)
DECLARE @x xml -- Use double quotation marks. SET @x = '<root a="1" />' SELECT @x GO DECLARE @x xml -- Use single quotation marks. SET @x = '<root a=''1'' />' SELECT @x GO
<root a="1" />
DECLARE @x xml SET @x = '<ns1:root xmlns:ns1="abc" xmlns:ns2="abc"> <ns2:SomeElement/> </ns1:root>' SELECT @x SELECT @x.query('/*') GO
<p1:root xmlns:p1="abc"><p1:SomeElement/></p1:root>
<?xml version="1.0" encoding="UTF-8"?> <xsd:schema …
-- Assign XML instance to a variable. DECLARE @X XML SET @X = N'…' -- Insert XML instance into an xml type column. INSERT INTO T VALUES (N'…') -- Create an XML schema collection CREATE XML SCHEMA COLLECTION XMLCOLL1 AS N'<xsd:schema … '