Using SQLXML Bulk Load in .NET Environment - Error with One to Many relationship on Complex Type
- by user331111
Hi,
I have an error when I am importing an XML file using SQLXMLBulkLoad, wondering if anyone could help.
Error:
Data mapping to column 'Attribute' was already found in the data. Make sure that no two schema definitions map to the same column
Full files and details can be found here http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SQL-Server-2005/Q_26102239.html
Exert from XSD:
<sql:relationship name="EnvironmentDECAttributes" parent="Environment" parent-key="intEnvironmentID" child="DECAttributes" child-key="intEnvironmentID"/>
<complexType name="Environment">
<sequence>
<element name="ESANumber" minOccurs="0">
<annotation>
<documentation>
Environmentally Sensitive Area Number
</documentation>
</annotation>
<simpleType>
<restriction base="string">
<maxLength value="15"/>
<whiteSpace value="collapse"/>
</restriction>
</simpleType>
</element>
<element name="Conditions" minOccurs="0" sql:relation="Conditions" sql:relationship="EnvironmentConditions">
<complexType>
<sequence>
<element name="Condition" type="vms:EnvironmentalConditions" minOccurs="0" maxOccurs="5"/>
</sequence>
</complexType>
</element>
<element name="DECDistrict" minOccurs="0">
<annotation>
<documentation>
Department of Environment & Conservation District
</documentation>
</annotation>
<simpleType>
<restriction base="string">
<maxLength value="31"/>
<whiteSpace value="collapse"/>
</restriction>
</simpleType>
</element>
<element name="DECAttributes" minOccurs="0" maxOccurs="1" sql:relation="DECAttributes" sql:relationship="EnvironmentDECAttributes">
<complexType>
<sequence>
<element name="Attribute" type="vms:DECAttributes" minOccurs="0" maxOccurs="unbounded" sql:field="Attribute">
<annotation>
<documentation>
Department of Environment & Conservation attributes.
</documentation>
</annotation>
</element>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
Exert from XML:
<Environment>
<DECAttributes>
<Attribute>WA</Attribute>
<Attribute>SA</Attribute>
</DECAttributes>
</Environment>
Any help/ comments would be appreciated
Thanks
C