Schema creation for BULK INSERT

G

Guest

I'm using WriteXmlSchema to create a schema from a dataset. The next step is to do a BULK INSERT into SQL SERVER 2000, but the XSD file needs the changes listed below to work correctly. Is there a better way to create a XSD for BULK INSERT? Or what is the best way to change and remove elements in the XSD to get it in the proper format. I have hundreds a table to do so I need a programatic way to accomplish this

Note there are more elements I just deleted them to make the example easier to read

The bulk insert works with objXBL.Execute("L://VB.NET//XMLimport//bin//CCorg.xsd", "L://VB.NET//XMLimport//bin//CCoutputs2.xml");

Orginal XS
<?xml version="1.0" encoding="utf-8"?><xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"><xs:element name="NewDataSet" msdata:IsDataSet="true"><xs:complexType><xs:choice maxOccurs="unbounded"><xs:element name="CCoutput"><xs:complexType><xs:sequence><xs:element name="ID" type="xs:int" minOccurs="0" /></xs:sequence></xs:complexType></xs:element></xs:choice></xs:complexType></xs:element></xs:schema

Needs to be.
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema
xmlns:sql="urn:schemas-microsoft-com:mapping-schema"><xsd:element name="CCoutput" sql:relation="CCoutputs" ><xsd:complexType><xsd:sequence><xsd:element name="ID" sql:field="ID" type="xsd:int" minOccurs="0" /></xsd:sequence></xsd:complexType></xsd:element></xsd:schema>
 
G

Guest

see repsting titled Schema (XSD) creation for BULK INSERT (Interop.SQLXMLBULKLOADLib) /repost/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top