D
Danny Smith
Can anyone help?
I want to find the fastest way of inserting a large number of records
(50,000+) into a SQL Server database (using C#).
The records are held in memory and the options I can think of are:
1. Creating a DataSet in memory and then calling the
DataAdapter.Update(dataSet) method. This runs an Insert query for each row
and ends up being quite slow. Is there any way to insert a whole DataSet at
once?
2. Calling a stored procedure for each record that inserts a row of data.
3. Using a BULK INSERT query. I believe this involves writing out to a text
file first.
4. Creating an XML document in memory and pass it to SQL Server. Not sure
if this is possible.
Any help much appreciated!
Danny Smith
I want to find the fastest way of inserting a large number of records
(50,000+) into a SQL Server database (using C#).
The records are held in memory and the options I can think of are:
1. Creating a DataSet in memory and then calling the
DataAdapter.Update(dataSet) method. This runs an Insert query for each row
and ends up being quite slow. Is there any way to insert a whole DataSet at
once?
2. Calling a stored procedure for each record that inserts a row of data.
3. Using a BULK INSERT query. I believe this involves writing out to a text
file first.
4. Creating an XML document in memory and pass it to SQL Server. Not sure
if this is possible.
Any help much appreciated!
Danny Smith