Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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.

share|improve this question

closed as off-topic by Mark Storey-Smith, Marian, Max Vernon, RolandoMySQLDBA, Kin Feb 6 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
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 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 at 17:36

1 Answer 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.

share|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 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 at 18:02

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