Link to home
Create AccountLog in
Avatar of saisandy
saisandy

asked on

sync two xmls

Playerlocaldb.xml is input to the stored procedure .

 I have to compare input xml (i.e playerlocaldb) with playerclouddb.xml (xml column in a table) based on timestamp attribute and make up a single xml.

for example:

PlayerslocalDB.xml:

<Team>
<Players>
<Player id="1" timestamp=" 11/03/2012 08:10:12 ">    30    </Player>
<Player id="2" timestamp="11/02/2012  09:11:12 ">    40    </Player>
<Players>

</Team>

PlayercloudDB.xml

<Team>

<Players>

<Player id="1" timestamp=" 11/02/2012 09:10:12 ">      10       </Player>
<Player id="2" timestamp=" 11/03/2012  10:11:12 ">     20   </Player>
<Player id="3" timestamp="11/03/2012 13:00:00  ">       50      </Player>

<Players>

</Team>


OUTPUT WHEN WE MERGE THE ABOVE TWO XMLS:

<Team>

<Players>

<Player id="1" timestamp=" 11/02/2012 09:10:12 ">       30       </Player>
<Player id="2" timestamp=" 11/03/2012  10:11:12 ">      20       </Player>
<Player id="3" timestamp="11/03/2012 13:00:00  ">       50      </Player>

<Players>

</Team>


plz help me with  how to merge two xmls in stored procedure (sql server 2005, sql server 2008)
ASKER CERTIFIED SOLUTION
Avatar of Saurabh Bhadauria
Saurabh Bhadauria
Flag of India image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of saisandy
saisandy

ASKER

Thx q for ur possible solution. I am applying on my system .

Could you please also tell me.. wht is difference between cross join vs inner join.

And this code works in both sql server 2005 and sql server 2008?
I guess  you are looking for difference between cross apply and inner join  :::

you can find it here...

http://explainextended.com/2009/07/16/inner-join-vs-cross-apply/ 


And this solution will work in  both versions ...