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

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

The statement I use to write out the schema is objDataset.WriteXmlSchema(xsdSW

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

Using Interop.SQLXMLBULKLOADLib 3.0 for BULK LOA

The bulk insert works corrently with objXBL.Execute("L://VB.NET//XMLimport//bin//CCorg.xsd", "L://VB.NET//XMLimport//bin//CCoutputs2.xml"); if I manually change the XSD file

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

-end of post-
 
C

Carl Huber [MS]

Hi,

Have you tried the bulk insert using the managed SQLXML namespace as
opposed to interop without changing the schema? The KB article below has
a download link to the latest version of SQLXML 3.0.

820728 - INFO: Frequently Asked Questions about SQLXML Installation
http://support.microsoft.com/?id=820728

Regards,
Carl Huber, MCSD
Microsoft Developer Support/Visual Basic WebData


This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! -> http://www.microsoft.com/security
 

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