什么是批量INSERT查询到SQL 2005/8的最有效和简单的方法

时间:2022-08-01 15:40:43

I'm new to ADO.NET so asking for help. I have to insert large number of records in one table.

我是ADO.NET的新手,所以请求帮助。我必须在一个表中插入大量记录。

What is best-practice, effective and easy way to do that? I found an article called Batch Requests (ADO.NET Data Services Framework) but it isn't clear for me.

什么是最佳实践,有效且简单的方法?我发现了一篇名为Batch Requests(ADO.NET Data Services Framework)的文章,但对我来说并不清楚。

Also I found an article about BULK INSERT but such method uses external file, I don't want to use it because of having an ASP.NET application.

我还发现了一篇关于BULK INSERT的文章,但这种方法使用外部文件,我不想因为拥有ASP.NET应用程序而使用它。

1 个解决方案

#1


Look at the SqlBulkCopy class. Also it sounds obvious, but not everyone knows this- you can significantly speed up insert performance by using transactions- I've blogged about this before.

查看SqlBulkCopy类。这听起来很明显,但不是每个人都知道这一点 - 你可以通过使用交易显着加快插入性能 - 我之前在博客上发表过这篇文章。

#1


Look at the SqlBulkCopy class. Also it sounds obvious, but not everyone knows this- you can significantly speed up insert performance by using transactions- I've blogged about this before.

查看SqlBulkCopy类。这听起来很明显,但不是每个人都知道这一点 - 你可以通过使用交易显着加快插入性能 - 我之前在博客上发表过这篇文章。