Friday, August 2, 2013

update script

Is this what you are looking for?



declare @case table(id int,condition varchar(2),scondition varchar(2),rn int)
insert into @case values(1,'HF','AA',1)
insert into @case values(1,'CA','LL',1)
insert into @case values(1,'XY','LL',1)
--insert into @case select id,condition,scondition,row_number() over (partition by id,intensity order by id) as rn from [CASE]
update @case set condition = (case
when condition in ('HF','CA') then scondition
when condition not in ('HF','CA') then null
end)
select * from @case





Regards, RSingh


No comments:

Post a Comment