SQLXML bulk load
I am trying to transform a large XML file and load it to SQLServer using bulk load function in MS SQLXML 3.0 with the following VBScript. It works for a file of about 18MB. However, when I try it with a 54MB file, the bulk load function breaks down with "Fatal Error - General Operation Error". Is there any problem with my script? Is there any other better way to do it? I may need to load file of size up to 400-500MB!!
' VBScript
' Flatten nested XML file using XSLT
set xsl = CreateObject("MSXML2.DOMDOCUMENT.4.0")
set xml = CreateObject("MSXML2.DOMDocument.4.0")
xml.validateOnParse = false
xml.async = false
xml.load "c:\temp\sampleXMLData2_b4XSLT.xml"
xsl.async = false
xsl.load "c:\temp\sampleXSLT2.xsl"
set inStm = CreateObject("ADODB.Stream")
inStm.Open
inStm.Charset = "UTF-8"
xml.transformNodeToObject xsl.documentElement, inStm
inStm.Position = 0
' Bulk load flattened XML file
set objBL = CreateObject("SQLXMLBulkLoad.SQLXMLBulkLoad.3.0")
objBL.ConnectionString = "provider=SQLOLEDB;data source=132.220.138.193;database=LISDB;uid=xxx;pwd=yyy"
objBL.ErrorLogFile = "c:\temp\error.xml"
objBL.Execute "c:\temp\sampleSchema2.xml", inStm
set objBL = Nothing
[1286 byte] By [
whkwok7] at [2007-11-18 19:07:17]

# 1 Re: SQLXML bulk load
Try using ADO and the BULK INSERT statement.
You can call it just like a SQL Statement, as long as you specify the path to the pipe or comma delimited file, and a format file.
You have to make a format file, but it should work. Or you can try to shell out and use bcp.exe. A good way to improve performance is to use the ROWS_PER_BATCH hint, 10000 is a good one to use usually.
Look in SQL Help for more info