快速插入200万行到SQL Server
问题描述:
我必须从文本文件中插入大约2百万行。
I have to insert about 2 million rows from a text file.
使用插入我必须创建一些主表。
And with inserting I have to create some master tables.
什么是最好的和快速的方式来插入这么大的数据集到SQL Server?
What is the best and fast way to insert such a large set of data into SQL Server?
答
您可以尝试使用 SqlBulkCopy 类。
允许您有效地批量加载来自
另一个源的数据的SQL Server表。 p>
Lets you efficiently bulk load a SQL Server table with data from another source.
有一个很酷的 blog post 关于如何使用它。
There is a cool blog post about how you can use it.