What’s the best way to bulk database inserts from c#?

前端 未结 10 2141
盖世英雄少女心
盖世英雄少女心 2020-12-02 14:22

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 collect

10条回答
  •  攒了一身酷
    2020-12-02 15:20

    I construct the list as an xml string and pass it to the stored proc. In SQL 2005, it has enhanced xml functionalities to parse the xml and do a bulk insert.

    check this post: Passing lists to SQL Server 2005 with XML Parameters

提交回复
热议问题