Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bulk update from .csv file

Status
Not open for further replies.

kristof

Programmer
Jun 2, 2000
234
BE
Hi,

I will need to process a .csv file, and use the data to update certain columns of existing records (of one table).

I expect the csv to have about 350K+ lines, so updating line per line, sending single update statements, would take ages.

Any ideas?
 
If the database in question is SQL Server and you are using .net 2.0, then you could use SqlBulkCopy to get your .csv into a table, and then run an update query from there.

Otherwise, you will need to do row by row inserts to get the data in, so you may as well just do row by row updates.

Wrapping all your updates/inserts in a transaction should help a little bit.

Hope this helps,

Alex


[small]----signature below----[/small]
Now you can go where the people are one!
Now you can go where they get things done!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top