removing root nodes from xmls in t-sql and merging them -


I'm really planning on the best way to merge XML data from SQL database.

I have a table in which there is an XML datatype, inside it XML is with the same schema I wanted to merge, we say, two xmls and a both at both ends & lt; Custom & gt; & Lt; / Custom & gt; is the route

First XML:

  & lt; Custom & gt; What is the best way to do this?  & lt; Data1 & gt; & Lt; ID & gt; 23,423 & lt; / Id & gt; & Lt; ROW1 & gt; Price & lt; / ROW1 & gt; & Lt; / Data1 & gt; & Lt; Data1 & gt; & Lt; ID & gt; 57568 & lt; / Id & gt; & Lt; ROW1 & gt; Price & lt; / ROW1 & gt; & Lt; / Data1 & gt; & Lt; Data1 & gt; & Lt; ID & gt; 56,756 & lt; / Id & gt; & Lt; ROW1 & gt; Price & lt; / ROW1 & gt; & Lt; / Data1 & gt; & Lt; / Custom & gt;  

Second XML:

  & lt; Custom & gt; & Lt; Data1 & gt; & Lt; ID & gt; 6575 & lt; / Id & gt; & Lt; ROW1 & gt; Price & lt; / ROW1 & gt; & Lt; / Data1 & gt; & Lt; Data1 & gt; & Lt; ID & gt; 8345 & lt; / Id & gt; & Lt; ROW1 & gt; Price & lt; / ROW1 & gt; & Lt; / Data1 & gt; & Lt; Data1 & gt; & Lt; ID & gt; 5666 & lt; / Id & gt; & Lt; ROW1 & gt; Price & lt; / ROW1 & gt; & Lt; / Data1 & gt; & Lt; / Custom & gt;  

Please ignore the id, the actual data is in GUID, so merge will not be difficult.

It seems as if you are saying that I have two basic XML nodes, which are the same Are with root nodes but some other (potential) are in common?

So if you want a system to compare the differences between them, then I know what is available in terms of net and open source accessories. It has already been thought out.

Merger is a very complex thing, if both parties have different values, then how can you decide who is "merge"? It is not as straightforward as you can think.

Below is the line. You need to explain your exact scenario in more detail to give a realistic response, but there is a lack in it, I recommend you to decide what you really want to do ... user intervention / without / Merge details in a more obvious problem and you will get better results.


Comments