RE: SQLXMLBulkLoad - relationship error

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hello,

You have to use sql:datatype annotation like this :
sql:datatype="varchar(10)" .

Best regards,
--
Monica Frintu


"Trillium" wrote:

I am using SQLXMLBulkLoad 3 to insert data into SQL Server 2000 database. I
have SchemaGen and SGDropTables both true, so the tables are dropped and
created for the new data. Everything works fine except for one relationship
that causes an error. When I comment this relationship out of the schema,
the upload works perfectly - except of course that the inserted data cannot
be related because the item is not included.

The relationship in question includes a varchar(10) field (all the rest are
integers). The parent table is created and loads correctly. However the
child table is created as a varchar(1), and errors out as too small for the
values. Is there some problem with varchar relationships?

Here are the 2 fields from the tables created in the database:
From the parent table:
[RecordType] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
From the child table:
[RecordType] [varchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,


Here is a snippet of the XSD showing element and annotations in question:


<!-- ... -->
<xsd:element name="ParentTable" sql:relation="tblUpldParentTable">
<xsd:annotation>
<xsd:appinfo>
<sql:relationship parent="tblUpldOrganization" parent-key="OrganizationId"
child="tblUpldParentTable" child-key="OrganizationId" />
</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ChildTable" sql:relation="tblUpldChildTable">
<xsd:annotation>
<xsd:appinfo>
<sql:relationship parent="tblUpldParentTable" parent-key="OrganizationId
FiscalYear RecordType" child="tblUpldChildTable" child-key="OrganizationId
FiscalYear RecordType" />
</xsd:appinfo>
</xsd:annotation>
...
<!-- ... from the ParentTable element attributes: -->
<xsd:attribute name="FiscalYear" type="xsd:integer" sql:field="FiscalYear"
sql:RecordType="bigint" />
<xsd:attribute name="RecordType" type="xsd:string" sql:field="RecordType"
sql:RecordType="varchar(10)" />
</xsd:complexType>
</xsd:element><!--ParentTable-->



.



Relevant Pages

  • Re: daMyDatatable.Update fails for linked dataset tables (using Ol
    ... Schema to None and now it works as it should. ... >> 1/ Add Parent record to Parent DataTable ... >> 2/ Add Associated Child Record to Child DataTable ... > set Accept/Reject Rule to Cascade, if you have then set it to None instead. ...
    (microsoft.public.dotnet.framework.adonet)
  • RE: Generating Schemas from one parent table and 2 child table
    ... that I need to generate a schema using BTS Schema generation wizard. ... table with 2 child table. ... are you talking about the SQL Adapter with updategrams? ... at-identity to copy the parent id to the child/children. ...
    (microsoft.public.biztalk.general)
  • RE: SQLXMLBulkLoad - relationship error
    ... It was stated correctly in the actual schema document though. ... You have to use sql:datatype annotation like this: ... The parent table is created and loads correctly. ... From the child table: ...
    (microsoft.public.sqlserver.xml)
  • RE: Schema: Relationship expected on Error
    ... I looked at your schema and I wanted to clarify one thing first:the child ... every child element that is mapped to a different table than the parent. ... > XML) to be informative in helping me with XML. ... > error 'Schema: relationship expected on 'PSECP200'' when executing my script. ...
    (microsoft.public.sqlserver.xml)
  • RE: Generating Schemas from one parent table and 2 child table
    ... table with 2 child table. ... I need to generate schema using ADD GENERATED ... at-identity to copy the parent id to the child/children. ...
    (microsoft.public.biztalk.general)