执行如下存储过程:

declare @scp_code  varchar(50);
declare @id INT;
DECLARE cur CURSOR FOR --查找s_link 有重复的路径
select cp_code from cp_sick
GROUP BY cp_code, s_link HAVING count(s_link) > 1;

OPEN cur 
fetch next from cur into @scp_code
while(@@fetch_status=0)
begin
print(@scp_code)
set @id=0
update cp_sick SET s_link=@id,@id=@id+1  WHERE  cp_code = @scp_code;

fetch next from cur into @scp_code
end 
close cur 
DEALLOCATE cur

Purpler
4 声望0 粉丝

成长,累积,进取...