declare cur cursor for select ....
open cur
while @@fetch_status=0
begin
if exists(select 1 from tb where id=@id)
begin
update tb set .... where id=@id
end
else
begin
insert tb....
end
fetch next from cur into....
end
close cur
deallocate cur
在长事务里面阻塞了其他查询,请问怎么处理比较好。
米脂
相关分类