Link to home
Start Free TrialLog in
Avatar of masbe
masbe

asked on

How do I do a multiple UPDATE ... WHERE ... ?

Question:

Is there a more efficient way to write this simple UPDATE query:

update Table1
set Field1 = 'String1' where Field2 = 'Value1';
update Table1
set Field1 = 'String2' where Field2 = 'Value2';
...
update Table1
set Field1 = 'StringN' where Field2 = 'ValueN'; ?

ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You have to write multiple statements for this. No other way round.
or if the where clause and value to be set have something common then do like this
update Table1
set Field1 = Replace(Field2, 'Value', 'String')
Avatar of masbe
masbe

ASKER

Worked fine. Thanks.