Best way to reinvent bulk insert?

S

Siegfried Heintze

Which is more efficient: a long series of SQL INSERT statements or
deserializing a dataset from XML and saving it to the table?

If I fill a dataset with current sample data and serialize it to XML, can I
expect to use that as a template to subsequently populate the table in the
future?

This way I can keep the XML under version control as well.

What function to I call to save a deserialized data set to a table?

We have been using bulk insert with sqlcmd but that is difficult to debug
and is specific to SQL Server.
 
W

William Vaughn [MVP]

Use SqlBulkCopy. It's dramatically faster than any SQL-based approach. It
can accept rowsets from anything that can expose IBindingList or has a .NET
data provider, OLE DB provider or ODBC driver.

--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker’s Guide to Visual Studio and SQL Server (7th Edition)
____________________________________________________________________________________________
 
S

Siegfried Heintze

Will it work for XML to MSAccess? Judging by the name space, it (SqlBulkCopy)
is specific to SQL Server.

I want to write a generic utility that will save and load XML to/from excel,
MSAccess, MySQL, SQL Server etc...

Can I do that by serializing/deserializing data sets? Is that the best way?

Thanks,
Siegfried
 

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