Uploading of xml to SQL Server

Joined
Jun 6, 2008
Messages
9
Programming Experience
Beginner
hello guyz

Im trying to load xml file to sql server but I dont have enough knowledge how to create schema xml, im using vbscript program to upload my xml,

here is my vbscript codings,

VB.NET:
Set objBL = CreateObject("SQLXMLBulkLoad.SQLXMLBulkLoad")
objBL.ConnectionString = "provider=SQLOLEDB.1;data source=codevelopment;database=Johnny;uid=restorer;pwd="
objBL.ErrorLogFile = "c:\error.log"
objBL.Execute "c:\customermapping.xml", "c:\customers.xml"
Set objBL = Nothing


here is my customers.xml;

HTML:
<ROOT>
  <Customers CustomerId="1111" CompanyName="Test 2" City="NY" />
  <Customers CustomerId="1234" CompanyName="Test 1" City="PH" />
  <Customers CustomerId="1432" CompanyName="Test 3" City="ML" />
</ROOT>


and here is my xml schema;

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

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

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

</Schema>

any help will be appreciated...thanks.
 
If you don't want to use VB.Net tools you have to ask for support at another site.
 

Latest posts

Back
Top