declare @id int,@num int
declare cur cursor for select ID,Num from Table1
open cur
fetch next from cur into @id ,@num
while @@fetch_status=0
begin
update Table2 set Num2 = @num where id = @id
fetch next from cur into @id,@num
end
close cur
deallocate cur
declare cur cursor for select ID,Num from Table1
open cur
fetch next from cur into @id ,@num
while @@fetch_status=0
begin
update Table2 set Num2 = @num where id = @id
fetch next from cur into @id,@num
end
close cur
deallocate cur