Home > Archive > MS SQL XML > September 2005 > One XML to multiple SQL tables









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author One XML to multiple SQL tables
guxu@hotmail.com

2005-09-30, 8:24 pm

I have one XML which contains data that would go in multiple tables. I
did an annotated schema file, but I could only get data into ONE of the
tables (TableM as shown below) and I get "The statement has been
terminated" error every time I tried to import the XML file. Nothing
was imported to the other two tables (Table1 and Table2). Anybody has a
clue?

Here is my XML file structure looks like
<tag1>..</tag1>
<tag2>..</tag2>
<table1 attrX1=.. attrX2 ...>
<table2 attrXX2=.. attrXX2 = ..>
<tag3>..</tag3>
....

Here is the schema structure
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
<xs:annotation>
<xs:appinfo>
<sql:relationship name="table1_R" parent="TableM" parent-key="ID"
child="table1" child-key="ID"/>
<sql:relationship name="table2_R" parent="TableM" parent-key="ID"
child="table2" child-key="ID"/>
</xs:appinfo>
</xs:annotation>
<xs:element name="test" sql:relation="TableM">
<xs:complexType>
<xs:sequence>
<xs:element name="Tag1" type="xs:integer"/>
<xs:element name="Tag2" type="xs:integer"/>
<xs:element name="Tag3" type="xs:integer"/>
<xs:element name="Table1" sql:relation="Table1"
sql:relationship="Table1_R">
<xs:complexType>
<xs:attribute name="attrX1" type ...>
<xs:attribute name="attrX2" type ...>
</xs:complexType>
</xs:element>

<xs:element name="Table2" sql:relation="Table2"
sql:relationship="Table2_R">
<xs:complexType>
<xs:attribute name="attrXX1" type ...>
<xs:attribute name="attrXX2" type ...>
</xs:complexType>
</xs:element>

</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com