September 15, 2004 at 3:59 pm
I have a large dataset (names; in this context) of more than 50000 records which i wanted to dump into SQL Server using SQLXMLBulkLoad. I use C# and here is how i implemented:
// Initialize OLEDB Connection for SQLXML Bulk Load
SQLXMLBulkLoad3Class bl = new SQLXMLBulkLoad3Class();
bl.ConnectionString = ConUtil.GetBulkXMLConString();
//bl.KeepIdentity = true;
bl.BulkLoad =
true;
//bl.Transaction = true;
bl.ErrorLogFile = "BulkImport.log";
bl.ForceTableLock =
false;
// Execute For Names
xmlSchema = ConfigUtil.GetProperty("NAMES_XML_SCHEMA");
xmlFile = ConfigUtil.GetProperty("NAMES_XML_FILE");
names.WriteXml(xmlFile);
bl.Execute(xmlSchema, xmlFile);
There was NO ERROR but NO ROWS got inserted into the database. there are no identity columns in the table. Connection and FilePaths are valid and tested. Any thoughts??? I do couple of bulk inserts using the same object. No Clue why it won't insert into database!?? Any help would be appreciated.
-- Gopal
September 16, 2004 at 7:31 am
Yep, that's what i got too. The XML schema created from the ado.net dataset is not compatable with what SQLXMLBulkLoad expects. Hard to believe that two things from microsoft would not be compatable. A couple of things need to be yanked from the dataset schema to make it compatable. (there was an example on some web site, i unfortunately don't have the link.) More of a pain than it was worth, I gave up and am now chaining out to bcp to dump and then reload.
February 14, 2008 at 10:17 pm
Please check if there is any namespace being specified in the XML doc.
Regards,
Shiv
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply