I have an xml with multiple elements and attributes ( you can see an example below ) and I want to make an SQL Table/Tables from it.
XML example:
<prgs>
<prg Id="1" >
<name>Xulescu</name>
<type>Human</type>
<attribs>
<attrib>doesn't matter</attrib>
</attribs>
<timeZone>doesn't matter</timeZone>
<URL>doesn't matter/</URL>
.....
</prgs>
I need to make a table like this
ID | Name
-------------------------
1 | Xulescu
......
Thank you
Another situation
What about this ?
<schedules type="tip1">
<schedule prgsId="15361" >
<event Id="1234" date="2012-10-05">
<times>
<time>01:00</time>
</times>
</event>
<event Id="2345" date="2012-10-05">
<times>
<time>01:30</time>
</times>
</event>
The result should be a table
ID ScheduleID PrgsID showId Date Time
.................................................................
1 xxx xxxx 1234 2012-10-05 01:00
2 xxx xxxx 2345 2012-10-05 01:30
ID is an autoincrement field
ScheduleID, PrgsID are FK keys
Something like this:
If your file contains this XML:
you’ll get this output:
Update: for your additional scenario – how about this? (assuming you already have your XML structure in a
@XMLvariable):Not sure how / which attribute you want in
ScheduleIdandPrgsId– I only see onePrgsIdattribute on<schedule>…