By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,378 Members | 1,267 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,378 IT Pros & Developers. It's quick & easy.

Xml Bulk Load in SQL 2000 relationship error

P: 26
Hi All,

I'm using SQL 2000 and in a DTS I want to load in an error XML file to a SQL table.

I am using the SQLXMLBulkLoad component in an Active X script.

I have an XML file. see below, and also an XSD schema file. Could someone take a look and see where I am going wrong??!

I get an error from SQL stating "Relationship expected on errors"

I need simply the contents of each error_msg tag to populate a field called errormsg in a table called Error_Response table

## START SCHEMA
[HTML]<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:dt="urn:schemas-microsoft-com:xml:datatypes" targetNamespace="mytargetnamespace.com" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
<xs:element name="stockorder_error" >
<xs:complexType>
<xs:sequence>
<xs:element name="errors" >
<xs:complexType>
<xs:sequence>
<xs:element name="error" sql:relation="Error_Response">
<xs:complexType>
<xs:sequence>
<xs:element name="error_message" sql:field="errormsg" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="version" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
</xs:schema>[/HTML]
## END SCHEMA

## START XML FILE
[HTML]
<?xml version="1.0" ?>
<stockorder_error xmlns="mytargetnamespace.com" version="1a" >
<errors>
<error>
<error_message>This is an error</error_message>
</error>
</errors>
</stockorder_error>[/HTML]
## END XML FILE

Thanks

mh
Jun 26 '08 #1
Share this Question
Share on Google+
1 Reply


P: 26
Found the issue

I changed from an XSD to XDR schema

and used the following:

[HTML]<?xml version="1.0" ?>
<Schema xmlns="urn:schemas-microsoft-com:xml-data"
xmlns:dt="urn:schemas-microsoft-com:xml:datatypes"
xmlns:sql="urn:schemas-microsoft-com:xml-sql"
sql:target-namespace="mytargetnamespace">


<ElementType name="stockorder_error" dt:type="string" sql:is-constant="1">
<AttributeType name="xmlns" required="no" dt:type="string"/>
<AttributeType name="version" required="no" dt:type="string"/>
</ElementType>

<ElementType name="error_message" dt:type="string" />

<ElementType name="error" sql:relation="Error_Response">
<element type="error_message" sql:field="errormsg" />

</ElementType>

</Schema>[/HTML]

behind the times for schemas I know, but least i got it working!
Jun 26 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.