Question : Inserting mass amounts of data to sqlserver from vb.net

Ok here is the situation  I need the fastest ways I can update large ammounts of data from vb to sql server 2000

what I will be doing is generating around 800 rows of data to insert into the database per loop

The program will loop 20 thousand times so you can see why I need to know the quickest way to get the 800 - 5000 rows inserted per loop.
All the rows are generated inside the program so this isn't something I can just load from a csv file.

using a data set vs update statements etc etc.  or anything else you can think of

Any ideas

Answer : Inserting mass amounts of data to sqlserver from vb.net

A few recomendations for the .NET program:
1.  Do not declare a new sqlCommand object for each insert, reuse the same object but change the parameters.
2.  Do no close the connection, open it before all the looping, and close when the looping is done.

A few recomendations for the SQL server:
1.  Remove all indexes and constraints on the table your appending to before appending this much data - your program should validate that the data is valid before inserting.  Rebuild the indexes & constraints after loading.

Another option would be to have the program export to a CVS (or similar file) and use DTS or a Bulk Insert Administrator to insert that much data.

Hope this helps!
Random Solutions  
 
programming4us programming4us