Hi, I am a newbie for SQL's XML section and need some help from you guys. I just go through some simple articles with simple sample record. However, I found confusing when I want to inserting data into several tables from a prefer XML file.
My scenario is like that :
Tables :
1) trade ( id int)
2) trans ( id int , startdate datetime , enddate datetime , status bit ,comment varchar(50), tranCode int)
* tranCode = id from trade table
3) transInfo ( id int , userlogin int , amount money , transID int ) * transID = id from trans table
4) trandetails ( id int, transID int ) * transID = id from trans table
Preferred XML :
<?xml version='1.0' encoding='utf-8'?>
<ROOT>
<trade code="1">
<trans id = '123' startdate = '2007-08-02 11:35:00' enddate='2007-04-29 11:36:00' status = '1' >
<transinfo>
<clienttrans login="Alex" amount="1000">
</clienttrans>
</transinfo>
<trandetails>
<trandetail><value>Shipping</value></trandetail>
</trandetails>
<comments><comment>Done</comment></comments>
</trans>
<trans id = '123' startdate = '2007-08-02 11:35:00' enddate='2007-04-29 11:36:00' status = '1' >
<transinfo>
<clienttrans login="Ken" amount="20000">
</clienttrans>
</transinfo>
<trandetails>
<trandetail><value>Transportation</value></trandetail>
</trandetails>
<comments><comment>Done</comment></comments>
</trans>
</trade>
</ROOT>
I am confusing on how to arrange up the elements based on the tables which were created. Or have to re-fix my table ? Any suggestion based on my scenario. Hope able to get any ideas/opinions from here asap. Thanks alot.
Best Regards,
Hans
Problem solved although kinda confusing at the early stage when doing the XML schema.
No comments:
Post a Comment