How do I/what’s the best way to do bulk database inserts?
In C#, I am iterating over a collection and calling an insert stored procedure for each item in the collection.
How do I send all the data in one database call?
E.g. say I have a person list (List<Person>
) containing 10 items. I am currently calling the InsertPerson stored proc 10 times. I would like to reduce this to 1 call.
I am using MS SQL Server 2005.
See Question&Answers more detail:os