Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Import huge delimited text files into MSSQL with C#
Message
De
23/03/2007 14:07:25
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
23/03/2007 13:55:29
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 2.0
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
01207643
Message ID:
01207862
Vues:
23
>Hi Cetin,
>
>Is SqlBulkCopy better than SQL's native Bulk Insert Statement?
>
>
>>Yes it has. Check SqlBulkCopy class.
>>Cetin

No, probably now SQL2005 is using the same class behind the scenes, I don't know. However with that class you have more control how it's bulk copied (mappings of columns, batch size, notification ...).
PS: I haven't tried but you might even try bulk uploading in multiple threads.

Update: From help
"Microsoft SQL Server includes a popular command-line utility named bcp for quickly bulk copying large files into tables or views in SQL Server databases. The SqlBulkCopy class allows you to 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.

The SqlBulkCopy class can be used to write data only to SQL Server tables. But the data source is not limited to SQL Server; any data source can be used, as long as the data can be loaded to a DataTable instance or read with a IDataReader instance.

Using the SqlBulkCopy class, you can perform:

A single bulk copy operation

Multiple bulk copy operations

A bulk copy operation within a transaction

Note
When using .NET Framework version 1.1 or earlier (which does not support the SqlBulkCopy class), you can execute the SQL Server Transact-SQL BULK INSERT statement using the SqlCommand object."

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform