Click to See Complete Forum and Search --> : multiply row and condition update (Same table)


yashish444
02-02-2009, 03:35 AM
Hi

I need to update more than 1 row with different condition (where clause) per row in the same table (SQL Server).

something like this:

UPDATE mytable SET name='josh' WHERE id='1' and lastName='watergate'

UPDATE mytable SET name='bob' WHERE id='2' and lastName='bluegun'



I want to merge those 2 statements into 1.
how can I do that in a most effective way ?

thanks

sridhar_423
02-02-2009, 05:32 AM
Update the same column with different values when the conditions are different. Better to have separate statements.