Using Microsoft SQL 2014, is there way to update multiple rows in the same table, with different values?
I have a table of costs for components and periodically I need to change the costs for all the individual components.
Currently, I do the following :
UPDATE table1 SET cost = '250' WHERE component = 'bicycle'
UPDATE table1 SET cost = '90' WHERE component = 'chainsaw'
UPDATE table1 SET cost = '0.10' WHERE component = 'overripe banana'
etc.
This seems a little inefficient to my mind, so is there a better way to do this? Something like an INSERT INTO table1 VALUES () but for an UPDATE statement.
So instead of running 10000 UPDATE statements, I can run one that updates multiple different rows.
Maybe it's not inefficient, which is fine too.
Thanks