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-
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-