Create this table: CREATE TABLE Cust(CustomerID int PRIMARY KEY, CompanyName varchar(20), City varchar(20)) GOCreate a file in Notepad, and save it as SampleSchema.xml. To this file, add the following XSD schema:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sql="urn:schemas-microsoft-com:mapping-schema"> <xsd:element name="Customers" sql:relation="Cust" > <xsd:complexType> <xsd:sequence> <xsd:element name="CustomerID" type="xsd:integer" /> <xsd:element name="CompanyName" type="xsd:string" /> <xsd:element name="City" type="xsd:string" /> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema>Create a file in Notepad, and save it as SampleXMLData.xml. To this file, add the following XML document:
<ROOT> <Customers> <CustomerID>1111</CustomerID> <CompanyName>Sean Chai</CompanyName> <City>NY</City> </Customers> <Customers> <CustomerID>1112</CustomerID> <CompanyName>Tom Johnston</CompanyName> <City>LA</City> </Customers> <Customers> <CustomerID>1113</CustomerID> <CompanyName>Institute of Art</CompanyName> </Customers> </ROOT>Create a file in Notepad, and save it as BLoad.vbs. To this file, add the VBScript code
set objBL = CreateObject("SQLXMLBulkLoad.SQLXMLBulkload.3.0") objBL.ConnectionString = "provider=SQLOLEDB;data source=localhost;database=Northwind;integrated security=SSPI" objBL.ErrorLogFile = "c:\error.log" objBL.Execute "SampleSchema.xml", "SampleXMLData.xml" set objBL=NothingModify the connection string to provide the appropriate server and database name. Execute the script file.
<ROOT> <Customers> <CustomerID><data>1111</data></CustomerID> <CompanyName><data>Sean Chai</data></CompanyName> <City><data>NY</data></City> </Customers> <Customers> <CustomerID><data>1112</data></CustomerID> <CompanyName><data>Tom Johnston</data></CompanyName> <City><data>LA</data></City> </Customers> <Customers> <CustomerID><data>1113</data></CustomerID> <CompanyName><data>Institute of Art</data></CompanyName> </Customers> </ROOT>Notice that there are "data" tags around all values. What should the SampleSchema.xml look like then is what I need to figure out. I've tried several alternatives, but none with success.