快速向 SQL Server 插入 200 万行

快速向 SQL Server 插入 200 万行

问题描述:

我必须从一个文本文件中插入大约 200 万行.

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 类.

You can try with SqlBulkCopy class.

让您高效地批量加载包含数据的 SQL Server 表另一个来源.

Lets you efficiently bulk load a SQL Server table with data from another source.

有一个很酷的博文 介绍如何使用它.

There is a cool blog post about how you can use it.