2

Possible Duplicate:
Speed up update of 185k rows in SQL Server 2008?

I have more than 700.000 contact mails and I want to insert them into SQL Server using C#, in a few minutes, not hours, in a single database call.

I know that pre is impossible but, I know there's way to do it

how can I achieve this?

Community
  • 1
  • 1
ksg
  • 3,927
  • 7
  • 51
  • 97
  • 1
    See [my reply about using bulk copy + an optional merge](http://stackoverflow.com/questions/12292644/speed-up-update-of-185k-rows-in-sql-server-2008/12379039#12379039), which is the fastest approach that *I* know of. –  Oct 25 '12 at 05:22

1 Answers1

3

Have a look at using SqlBulkCopy Class

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

Microsoft SQL Server includes a popular command-prompt utility named bcp for moving data from one table to another, whether on a single server or between servers. The SqlBulkCopy class lets you write managed code solutions that provide similar functionality. There are other ways to load data into a SQL Server table (INSERT statements, for example), but SqlBulkCopy offers a significant performance advantage over them.

Adriaan Stander
  • 162,879
  • 31
  • 289
  • 284