BUG: SQL Server XML Bulk Load Object Retains First Schema Information and Uses it For Subsequent Invocation of the Execute Method (298990)



The information in this article applies to:

  • Microsoft SQL Server 2000 (all editions)

This article was previously published under Q298990
BUG #: 353837 (SHILOH_BUGS)

SYMPTOMS

When you invoke the Execute method of a SQLXMLBulkload object more than once with different schemas, the Execute method always uses the first schema parameter and ignores any new schema parameter. However, the Execute method does read the new XML data parameter. This behavior makes the SQLXMLBulkLoad Execute method inconsistent.

CAUSE

In some way, the SQLAMLBulkLoad object retains the table information that it got from the first XML schema. When the Execute method of the SQLXMLBulkload object is executed with a different schema, the SQLXMLBulkload object does not seem to read the new schema file but does read the XML data.

WORKAROUND

To make sure that a new table is created based on the corresponding XML schema, re-initialize the SQLXMLBulkload object or use the new SQLXMLBulkload object.

STATUS

Microsoft has confirmed this to be a problem in SQL Server 2000.

MORE INFORMATION

Steps to Reproduce Problem

Use the code that follows to demonstrate the problem:
objBL.Execute "c:\xmlSampleSchema.xml", "C:\xml\SampleData.xml"  
objBL.Execute "c:\xmlSampleSchema2.xml", "c:\xml\SampleData2.xml"  
				
  • When you first invoke the Execute method of the SQLXMLBulkload object, the schema is used and the data that corresponds to the first schema is inserted into the table specified in the schema as expected.

  • On any subsequent invocation of the Execute method of the SQLXMLBulkload object, the second schema is not used as you expect. Instead of creating a new table based on the second XML schema parameter that was just passed, the table specified in the first schema is re-created or re-used, depending upon whether the objBL.SchemaGen and objBL.SGDropTables properties are set on.

Modification Type:MajorLast Reviewed:10/3/2003
Keywords:kbBug kbpending KB298990