AMIT GUPTA-263376
SSCarpal Tunnel
Points: 4244
More actions
February 8, 2006 at 8:29 am
#619540
You can use the following Query :
update test_update
set name=(case when id=1 then 'aaa'
when id=2 then 'bbb'
when id=3 then 'ccc'
else null end)
where id=?
rsharma
Points: 4865
February 8, 2006 at 9:22 am
#619557
And change the id = ? to id in (1, 2, 3)
sql_fan
SSC-Addicted
Points: 462
February 8, 2006 at 11:41 am
#619599
Thanks for your help. It helped me a lot.
Jesper-244176
SSCertifiable
Points: 7142
February 9, 2006 at 4:58 am
#619732
Alternative:
UPDATE t
set t.Name = u.name
from test_update t
inner join
(
select 1 as Id, 'aaa' as Name union all
select 2, 'bbb' union all
select 3, 'ccc'
)
u on t.Id = u.Id
Viewing 4 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply