1

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.

closed as off-topic by Mark Storey-Smith, Marian, Max Vernon, RolandoMySQLDBA, Kin Shah Feb 6 '14 at 20:18

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Shopping list question - questions about which tool, library, product or resource you should use are off-topic here because they quickly become obsolete and often are just about the preferences of the answerer. If you have an issue with or a question about a specific tool, please revise your question to conform to that scope." – Mark Storey-Smith, Marian, Max Vernon, Kin Shah
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 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
1

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.

  • 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.