Her er min kode (nogen til visning af DMI data). Forhåbenligt kan den hjælpe dig lidt. Den her slags SQL import skaber en masser overhead i transaction loggen, så husk backups.
dbConnection = Application("ConnectionString")
Set Conn = CreateObject("ADODB.Connection")
Conn.Open dbConnection
Conn.Execute("EXEC qPD_DeleteOldData")
Set objBL = CreateObject("SQLXMLBulkLoad.SQLXMLBulkLoad.3.0")
objBL.ConnectionString = Application("ConnectionString")
objBL.SGDropTables = True
objBL.KeepIdentity = False
objBL.Execute "F:\WebSites\Weather\mapping.xsd","F:\Websites\Weather\weather.xml"
Set objBL = Nothing
Conn.Close
Mapping.xsd
<xsd:schema xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns:sql="urn:schemas-microsoft-com:mapping-schema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:annotation>
<xsd:appinfo>
<sql:relationship name="Mast_Atim" parent="DKMaster" parent-key="Id" child="AnalysisTime" child-key="MasterId" />
<sql:relationship name="Mast_Vali" parent="DKMaster" parent-key="Id" child="Validity" child-key="MasterId" />
<sql:relationship name="Mast_Prod" parent="DKMaster" parent-key="Id" child="ProductionTime" child-key="MasterId" />
<sql:relationship name="Mast_Area" parent="DKMaster" parent-key="Id" child="DataArea" child-key="MasterId" />
<sql:relationship name="Mast_Cont" parent="DKMaster" parent-key="Id" child="Continent" child-key="MasterId" />
<sql:relationship name="Cont_Coun" parent="Continent" parent-key="Id" child="Country" child-key="ContinentId" />
<sql:relationship name="Coun_Loca" parent="Country" parent-key="Id" child="Location" child-key="CountryId" />
<sql:relationship name="Loca_Posi" parent="Location" parent-key="Id" child="Position" child-key="LocationId" />
<sql:relationship name="Loca_Day" parent="Location" parent-key="Id" child="FC_Day" child-key="LocationId" />
<sql:relationship name="Day_Para" parent="FC_Day" parent-key="Id" child="Parameter" child-key="FCId" />
</xsd:appinfo>
</xsd:annotation>
<!-- Start DKMaster Schema -->
<xsd:element name="DKMaster" sql:key-fields="Id" sql:relation="DKMaster">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Provider" type="xsd:string" />
<!-- Start DataArea Schema -->
<xsd:element name="DataArea" sql:key-fields="Id" sql:relation="DataArea" sql:relationship="Mast_Area">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="area" type="xsd:string" />
<xsd:element name="data" type="xsd:string" />
<xsd:element name="dataprocessing" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!-- End DataArea Schema -->
<!-- Start AnalysisTime Schema -->
<xsd:element name="AnalysisTime" sql:key-fields="Id" sql:relation="AnalysisTime" sql:relationship="Mast_Atim">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="year" type="xsd:integer" />
<xsd:element name="month" type="xsd:integer" />
<xsd:element name="day" type="xsd:integer" />
<xsd:element name="hour" type="xsd:integer" />
<xsd:element name="time" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!-- End AnalysisTime Schema -->
<!-- Start Validity Schema -->
<xsd:element name="Validity" sql:key-fields="Id" sql:relation="Validity" sql:relationship="Mast_Vali">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="year" type="xsd:integer" />
<xsd:element name="month" type="xsd:integer" />
<xsd:element name="day" type="xsd:integer" />
<xsd:element name="fc_days" type="xsd:integer" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!-- End Validity Schema -->
<!-- Start ProductionTime Schema -->
<xsd:element name="ProductionTime" sql:key-fields="Id" sql:relation="ProductionTime" sql:relationship="Mast_Prod">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="year" type="xsd:integer" />
<xsd:element name="month" type="xsd:integer" />
<xsd:element name="day" type="xsd:integer" />
<xsd:element name="hour" type="xsd:integer" />
<xsd:element name="min." type="xsd:integer" sql:field="min" />
<xsd:element name="time" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!-- End ProductionTime Schema -->
<!-- Start Continent Schema -->
<xsd:element name="continent" sql:key-fields="Id" sql:relation="Continent" sql:relationship="Mast_Cont">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="name" type="xsd:string" />
<!-- Start Country Schema -->
<xsd:element name="country" sql:key-fields="Id" sql:relation="Country" sql:relationship="Cont_Coun">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="name" type="xsd:string" />
<!-- Start Location Schema -->
<xsd:element name="location" sql:key-fields="Id" sql:relation="Location" sql:relationship="Coun_Loca">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="name" type="xsd:string" />
<xsd:element name="aliasname" type="xsd:string" />
<!-- Start Position Schema -->
<xsd:element name="position" sql:key-fields="Id" sql:relation="Position" sql:relationship="Loca_Posi">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="unit" type="xsd:string" />
<xsd:element name="latitude" type="xsd:string" />
<xsd:element name="longitude" type="xsd:string" />
<xsd:element name="station_no" type="xsd:string" />
<xsd:element name="time_zone" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!-- Close Location Schema -->
<!-- Start FC_Day Schema -->
<xsd:element name="fc_day" sql:key-fields="Id" sql:relation="FC_Day" sql:relationship="Loca_Day">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="day_index" type="xsd:string" />
<!-- Start Parameter Schema -->
<xsd:element name="parameter" sql:key-fields="Id" sql:relation="Parameter" sql:relationship="Day_Para">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="name" type="xsd:string" />
<xsd:element name="unit" type="xsd:string" />
<xsd:element name="dataprocessing" type="xsd:string" />
<xsd:element name="value" type="xsd:decimal" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!-- Close Parameter Schema -->
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!-- Close FC_Day Schema -->
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!-- Close Location Schema -->
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!-- Close Country Schema -->
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!-- Close Continent Schema -->
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!-- Close DKMaster Schema -->
</xsd:schema>