I have done some research for “The bast way to insert huge data into DB with C#” then a lot of people just suggested me using SqlBulkCopy. After I tried it out and it really amazed me. Undoubtedly, SqlBulkCopy is very very fast. It seems that SqlBulkCopy is a perfect way to insert data (especially huge data). But why dont we use it at all times. Is there any drawback of using SqlBulkCopy?
Share
Two reasons I can think of:
inserts, but occasionalinserts intermixed withselects andupdates. Microsoft themselves state that a normalinsertis more efficient for that, on theSqlBulkCopyMSDN page.Note that if you want a
SqlBulkCopyto be equivalent to a normal insert, at the very least you’ll have to pass it theSqlBulkCopyOptions.CheckConstraintsparameter.