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 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…