Can anyone tell me what is best way to bulk insert/update data to SQL SERVER 2012 using C#? I have an excel file which I am passing as TVP(table value parameter) to a SP. But this is little bit slower. Any hint will appreciated.

  • Can you tell us more about what the procedure does with the data once it's on the SQL side? – Jon Seigel Jan 26 '14 at 15:35
  • @JonSeigel, Actually from excel I am extracting lot of tables which I am passing in SP as a TVP. Inside SP, I am simply updating or inserting these into my db tables using the TVPs. There may be around 10 to 15 tables come into play. – user960567 Jan 26 '14 at 17:36

What about "NO FORMAT"? Use SqlBulkCopy to dump the data into a temp table. No need to put a file in a place the server can read at all.

| improve this answer | |
  • Actually I need to extract data from an excel file at runtime and need to be format this excel file before inserting/updating into my db tables. Currently, I am using TVP. SqlBulkCopy only works with insert – user960567 Jan 26 '14 at 17:59
  • Ah, no. It does not only work with insert - yes, you can only directly insert, but that can go into a temporary table for further processing. THis is what I do. – TomTom Jan 26 '14 at 18:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.