I have a 270k-row database with primary key mid and a column called value, and I have a text file with mid’s and values. Now I would like to update the table such that each value is assigned to the correct mid.
My current approach is reading the text file from C#, and updating a row in the table for each line that I read. There must be quicker way to do things I feel.. any ideas?
EDIT: There are other columns in the table, so I really need a method to update according to mid.
You could use the SQL Server Import and Export Wizard:
http://msdn.microsoft.com/en-us/library/ms141209.aspx
Alternatively you could use the
BULKTSQL Statement:Assuming you are splitting on a comma delimiter. If you are using another character such as a space, change the FIELDTERMINATOR to the associated character.
Edit (To achieve the update from my comment):