| Re: Extract and Insert Xml nodes |
|
 |
|
 |
|
 |
|
 |
Group: microsoft.public.sqlserver.xml · Group Profile
Author: Mike C#Mike C# Date: Feb 21, 2008 21:59
You could use XML DML insert statement, although in 2005 it is limited. You
would do better to grab the member_id scalar value using the .value() method
and use that to insert new nodes in table2 with XML DML if you decide to go
the XML DML route.
gmail.com> wrote in message
news:f03870e2-ad03-4a80-ba56-6384d6fa428c@b29g2000hsa.googlegroups.com...
>I figured out how to extract the nodes:
>
> SELECT NewTable.Member.query('.')
> FROM table1 CROSS APPLY xml_data.nodes('/group/member') AS
> NewTable(Member)
> WHERE pk_column_id = 1 AND Member.value('@member_id', 'int') NOT IN
> (SELECT ref.value('@member_id', 'int') FROM table2
> CROSS APPLY
> sync_data.nodes('/group/member') AS node(ref) WHERE pk_column_id = 1)
>
> Now I just need to know how to update table2 with the results...
|