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

แชร์
ฝัง
  • เผยแพร่เมื่อ 16 ธ.ค. 2024

ความคิดเห็น • 19

  • @Tanghero123
    @Tanghero123 ปีที่แล้ว +3

    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
      @DotNetCoreCentral  ปีที่แล้ว

      Great point, thanks!

    • @tayyabbhatti6781
      @tayyabbhatti6781 ปีที่แล้ว +1

      @@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

  • @liamhotspur9182
    @liamhotspur9182 ปีที่แล้ว +1

    I love your videos, simple and straight!

  • @sreenuksr
    @sreenuksr ปีที่แล้ว +1

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

  • @efimtenkin1641
    @efimtenkin1641 ปีที่แล้ว

    Thank you, you helped me a lot

  • @pardhasaradhi0076
    @pardhasaradhi0076 ปีที่แล้ว

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

  • @coding-gemini
    @coding-gemini ปีที่แล้ว

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

  • @Thalapraga
    @Thalapraga ปีที่แล้ว

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

  • @zulfiqar7967
    @zulfiqar7967 ปีที่แล้ว

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

  • @Proviper666
    @Proviper666 ปีที่แล้ว +1

    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);

  • @sravs3054
    @sravs3054 9 หลายเดือนก่อน

    Awesome

  • @NaaiSekar-cc4ef
    @NaaiSekar-cc4ef หลายเดือนก่อน

    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.

  • @TommiLipponen
    @TommiLipponen ปีที่แล้ว

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

    • @DotNetCoreCentral
      @DotNetCoreCentral  ปีที่แล้ว +2

      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.