I need to replace more than 20 000 names with new names i created given the CodeID.
For example: I must update all rows that contain “dog” (which has a CodeID of 1) with “cat”, and update all rows that contain “horse” (which has a CodeID of 2) with “bird”, etc.
1st SQL statement: UPDATE animalTable SET cDescription = “cat” WHERE CodeID = 1
2nd SQL statement: UPDATE animalTable SET cDescription = “bird” WHERE CodeID = 2
These statements work, but i need a faster way to do this because i have over 20 000 names.
Thank you in advance.
Thats the fastest way you can do it.
Or do you want update all records in a single command?
you can do a update with a join (Fixed Syntax… Havent used this one in a while)
Another option is to split the updates into smaller batches, this will reduce the time the table is locked… But the total time of the updates will take longer (Its just an improvement of precieved Performance) You can do that by updating only certain ID ranges in each batch.
Also you could have that data in a separate table. Since the data is not normalized. Move it away so its more normalized.