Systems Engineering and RDBMS

XML DML Enhancement in SQL Server 2008

Posted by decipherinfosys on May 6, 2008

This is another post to mention one more enhancement made in the next version of SQL Server.   In SQL Server 2005 itself, the XML data type supports several methods such as value, exist, modify, query and nodes.  These methods allow querying as well as modifying an XML instance.  The modify method in SQL Server 2008 now also allows DML on the XML instances.  Here is an example:

Do the declarations and the assignments
declare @a xml = ‘<root><sku ID=”10″/><sku ID=”20″/></root>’;
declare @b xml = ‘<sku ID=”1″/>’;

Do the set and the modify
SET @a.modify (‘insert sql:variable(“@b”) as first into (/root)[1]’);
select @a;

<sku ID=”1″ />
<sku ID=”10″ />
<sku ID=”20″ />

2 Responses to “XML DML Enhancement in SQL Server 2008”

  1. […] decipherinfosys on June 2, 2008 We had covered one of the XML enhancements in SQL Server 2008 in a blog post before. And in case you missed it, you can download all our blog posts on SQL Server 2008 (till […]

  2. […] also suggests, this method is used do DML operations against a XML instance.  We had covered this here and […]

Sorry, the comment form is closed at this time.

%d bloggers like this: