Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 Bulk load with multiple element types.
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

United Kingdom
15 Posts

Posted - 02/13/2013 :  06:48:32  Show Profile  Reply with Quote
Hi, I'm using Bulk Load to import from xml file, which works fine for most xml files. However, I have a schema where there are multiple element types within the main element type.



<CompanyName>Sean Chai</CompanyName>



It ignores the City element altogether.

I've tried adding an extra <element type="Test" /> to the mapping file but it just ignores it. Can anyone help ?

many thanks


Very Important crosS Applying yaK Herder

52326 Posts

Posted - 02/13/2013 :  06:58:27  Show Profile  Reply with Quote
you need to modify your xsd schema accordingly to make Test complexType and add element City inside it

something like

<xs:element name="Test">
      <xs:element name="City" type="xs:string" minOccurs="0" maxOccurs="unbounded" />

the minOccurs part is required if its optional and maxOccurs is required if it can repeat'
similarly add sections for other elements inside

SQL Server MVP

Go to Top of Page

Starting Member

United Kingdom
15 Posts

Posted - 02/13/2013 :  07:33:54  Show Profile  Reply with Quote
Thanks for reply. The sample schema I'm using follows a different format to that.

<?xml version="1.0" ?>
<Schema xmlns="urn:schemas-microsoft-com:xml-data"
xmlns:sql="urn:schemas-microsoft-com:xml-sql" >

<ElementType name="CustomerId" dt:type="int" />
<ElementType name="CompanyName" dt:type="string" />
<ElementType name="City" dt:type="string" />

<ElementType name="ROOT" sql:is-constant="1">
<element type="Customers" />
<element type="Test" />

<ElementType name="Customers" sql:relation="Customer">
<element type="CustomerId" sql:field="CustomerId" />
<element type="CompanyName" sql:field="CompanyName" />
<element type="City" sql:field="City" />


I have tried adding a new element type under the root, but all fields are entered into database except the City

Sorry if I'm missing something..



Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000