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.
@@DotNetCoreCentral to eliminate this issue, you have to first count the total records by executing the query. then loop start from the count to the length. this will help you
Can some one help? System.InvalidOperationException: '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 SqlConnection(connectionString);
What is the efficient way to join 5 SQL server tables and store the result data in another sql server table which resides in another database. Join may bring data in billions.
Yes, you can first read the CSV file in chunks, add the data o the data table, and then bulk upload. I will suggest using chunks of 1000 records or some number like that to avoid memory as well as SQL Server timeout issues. But that will depend on the complexity of the data structure.
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.
Great point, thanks!
@@DotNetCoreCentral to eliminate this issue, you have to first count the total records by executing the query. then loop start from the count to the length. this will help you
I love your videos, simple and straight!
thanks!
I am following your series. nice videos and explanation. Wish you happy new year.
Thanks! And wish you a Happy New Year!
Thank you, you helped me a lot
Glad I could help!
I have a question. Iam using bulkcopy but i would like to return identity row. Please suggest
Excellently explained, thanks for the video. Can you create a video for bulkupdate if any ?
Thanks!
Can it be used for bulk insert of 10 million rows?
We can do it bulk insert in sql query itself.. it’s very safe and good performance..
Can some one help?
System.InvalidOperationException: '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 SqlConnection(connectionString);
Awesome
What is the efficient way to join 5 SQL server tables and store the result data in another sql server table which resides in another database. Join may bring data in billions.
Dear Sir, can this method be used for to copy hundreds of thousands rows from CSV file to MSSQL database?
Yes, you can first read the CSV file in chunks, add the data o the data table, and then bulk upload. I will suggest using chunks of 1000 records or some number like that to avoid memory as well as SQL Server timeout issues. But that will depend on the complexity of the data structure.