Can I do a very large insert with Linq-to-SQL?

前端 未结 4 822
醉酒成梦
醉酒成梦 2021-01-15 01:13

I\'ve got some text data that I\'m loading into a SQL Server 2005 database using Linq-to-SQL using this method (psuedo-code):

Create a DataContext

While (ne         


        
4条回答
  •  旧时难觅i
    2021-01-15 01:49

    You would want to call SubmitChanges() every 1000 records or so to flush the changes so far otherwise you'll run out of memory.

    If you want performance, you might want to bypass Linq-To-SQL and go for System.Data.SqlClient.SqlBulkCopy instead.

提交回复
热议问题