Upload bulk data into SQL Server 2008 from .csv

asp.net c# sqlbulkcopy

Question

I want to let my users to upload 3000-4000 rows of data into SQL Server 2008. I would like to use SqlBulkCopy. What is the best policy to do it?

Option A:

  • First the .csv file will be uploaded to the server and then SqlBulkCopy operation will be started.

Option B:

  • Read .csv file from user's pc and then send that data to the server.

I am new to ASP.Net.

Thank you.

Accepted Answer

It really depends on your scenario and what you mean by 'fastest'. To "load" the data server side (meaning, option A, upload, then import) will almost certainly be faster on the server side. But you could also 'process' the data client side and launch an async uploader if the user experience is more important.

I would go with Option A just to keep the 'upload' decoupled from the 'import' process.



Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow