Monthly Archives: October 2007

sql:variable() binding and modify method of xquery: insert XML DML

/* In SQL Server 2005, we can use sql:variable and sql:column function to bind relational data into XML by means of xquery. However, the binding has special syntax and it is easy to be confused. 1) insert ELEMENT: The element … Continue reading

Posted in SQL server 2005 | Leave a comment

CDATA and xml data type

In a recent post, it talked about CDATA section and SQL Server xml data type. SQL Server does not preseve the CDATA section in an xml. E.g.:   DECLARE @x xml; SET @x = ‘<element><![CDATA[foo & bar]]></element>’; SELECT @x   … Continue reading

Posted in SQL server 2005 | Leave a comment

Change root name of an XML document

In SQL Server 2005, we can easily change the root name of an xml document. Actually we are not "changing" it, we create a new root and add all the elements of the old root under the new one.   … Continue reading

Posted in SQL server 2005 | Leave a comment