• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1716
  • Last Modified:

SQLXMLBULKLOAD relationship expected

Runniing SQLXMLBULKLOAD I have the following error message
Schema: relationship expected on 'product'.
As I am just writing to the one table (InputGlobalFeed) i dont believe that I need to set up any reationships,and cannot think of ones I could set up. Can anyone spot where this XSD schema is going wrong?

<xsd:schema xmlns:sql="urn:schemas-microsoft-com:mapping-schema" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:element name="products">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element sql:relation="InputGlobalFeed" name="product">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element sql:field="IGFMerchantProductName" name="ProductName" type="xsd:string" />
              <xsd:element sql:field="IGFProductPrice" name="ProductPrice" type="xsd:string" />
              <xsd:element sql:field="IGFProductDescription" name="ProductDescription" type="xsd:string" />
              <xsd:element sql:field="IGFSummaryDescription" name="SummaryDescription" type="xsd:string" />
              <xsd:element sql:field="IGFBrand" name="BrandName" type="xsd:string" />
              <xsd:element sql:field="IGFGender" name="Gender" type="xsd:string" />
              <xsd:element sql:field="IGFSalesRank" name="SalesRank" type="xsd:string" />
              <xsd:element sql:field="IGFDelivery" name="Delivery" type="xsd:string" />
              <xsd:element sql:field="IGFMerchantProductId" name="ProductID" type="xsd:string" />
              <xsd:element sql:field="IGFAffiliateURL" name="AffiliateURL" type="xsd:string" />
              <xsd:element sql:field="IGFImageURL" name="ImageURL" type="xsd:string" />
              <xsd:element sql:field="IGFProductAddedDate" name="ProductAddedDate" type="xsd:string" />
              <xsd:element sql:field="IGFProductUpdatedDate" name="ProductUpdatedDate" type="xsd:string" />
              <xsd:element sql:field="IGFCategory" name="Category" type="xsd:string" />
              <xsd:element sql:field="IGFMerchantName" name="MerchantName" type="xsd:string" />
              <xsd:element sql:field="IGFImageURL50by50" name="ImageURL50by50" type="xsd:string" />
              <xsd:element sql:field="IGFImageURL100by100" name="ImageURL100by100" type="xsd:string" />
              <xsd:element sql:field="IGFImageURL120by120" name="ImageURL120by120" type="xsd:string" />
              <xsd:element sql:field="IGFImageURL200by200" name="ImageURL200by200" type="xsd:string" />
              <xsd:element sql:field="IGFImageURL234by234" name="ImageURL234by234" type="xsd:string" />
              <xsd:element sql:field="IGFImageURL300by300" name="ImageURL300by300" type="xsd:string" />
              <xsd:element sql:field="IGFImageURL400by400" name="ImageURL400by400" type="xsd:string" />
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>

Open in new window

0
Simon Cripps
Asked:
Simon Cripps
  • 2
1 Solution
 
neeraj523Commented:
hello

you need to check your db structure well.. your table must be having column referencing other tables..
0
 
Simon CrippsAuthor Commented:
All columns on db were checked and matched the XML structure.
As I am using just one table here I could not see how the relationship was required.

The solution came from updating the <xsd:element name="products"> to include  sql:is-constant="1"
Looking at http://msdn.microsoft.com/en-us/library/aa258641(SQL.80).aspx this makes sure that the element is not maped to any SQL field. Therefor I suspect that as this was not included in the origional XSD the Bulk Load read that Products was to be related to on parent table and Product to a child table. Setting sql:is-constant="1" resolved this as just requireing one table.
0
 
Simon CrippsAuthor Commented:
Have now changed this to SQLXMLBULKLOAD and after some time setting it up have come to a solution mapping the elements to the fields. A lot of work but a better solution.
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now