Extremely easy way to bulk insert data into SQL Server using SqlBulkCopy class

preview_player
Показать описание
Insert bulk data into the SQL Server table from an in-memory source or another database table using the SqlBulkCopy class.

00:00 - Introduction
00:32 - Create a new instance of SqlBulkCopy class
01:04 - Different useful properties of SqlBulkCopy class
03:30 - The main method for writing bulk data
04:20 - Using DataTable for bulk insert
07:30 - Using DataReader for bulk insert
10:05 - EnableStreamin property of SqlBulkCopy class

#csharp #dotnet #sqlserver

Some of my popular videos:

Рекомендации по теме
Комментарии
Автор

Thanks for the video. I used this for one of our projects and found it to be quite efficient. The only downside is that you need to be extra careful with things that might cause an error like duplicate primary keys, as sqlBulkCopy does not return good error messages when something goes wrong. - Chris T.

Tanghero
Автор

I love your videos, simple and straight!

liamhotspur
Автор

I am following your series. nice videos and explanation. Wish you happy new year.

sreenuksr
Автор

Can some one help?
'The ConnectionString property has not been initialized.'
EDIT:
I solved by adding direct connection string.
string connectionString = "Data Source=.;Initial Catalog=YourDBname;Integrated Security=True;";
using var connection = new

Proviper
Автор

I have a question. Iam using bulkcopy but i would like to return identity row. Please suggest

pardhasaradhi
Автор

We can do it bulk insert in sql query itself.. it’s very safe and good performance..

zulfiqar
Автор

Can it be used for bulk insert of 10 million rows?

Thalapraga
Автор

Excellently explained, thanks for the video. Can you create a video for bulkupdate if any ?

coding-gemini
Автор

Dear Sir, can this method be used for to copy hundreds of thousands rows from CSV file to MSSQL database?

TommiLipponen
visit shbcf.ru