How to upload Dataset read from XML to SQL Server Database

N

Neo

Hello All,

I am using SQL Server 2000 and .Net 2.0. I want to import XML files
into database. SQLXMLBulkLoad is useless since, our schema doesn't have
annotation required by that.

But I could read schema and xml file in dataset without problem. Now
only quesiton is how to insert this dataset in database. One way is
insert each record from dataset at a time, which I think is pretty
crude way. Is there any faster way to do bulk insert of dataset loaded
from xml into database?

Best Regards,
Pravin
 
C

Cowboy \(Gregory A. Beamer\)

From a developer standpoint, you can set up a DataAdapter and call update,
but that is still record by record behind the scenes, at least AFAIK.

You could send the DataSet XML into the server as a string and have it
insert using OPENXML, but I have not been able to get this to work properly
in SQL 2000 without stripping the xmlns attribute from the root tag, which
requires working with it as a string. Once the attribute is gone, everything
is fine. Note that this reduces the amount of info you can load at a time,
unless you move to a text type for input, which can be problematic. For
large XML files, you may have to chunk.

While very outside of the box, BizTalk is another option, but an expensive
one if this is the only purpose for it.

--
Gregory A. Beamer

*************************************************
Think Outside the Box!
*************************************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top