Hii have two tables as like this :tbl1 :id uniqueidentifier pkparvande nvarchar(20) unique
tbl2 :id uniqueidentifier pkparvande nvarchar(20) uniquetbl1ID uniqueidentifier Fk
the Third column in tbl2 (tbl1ID) add after table created and some values enter to it, now tbl1ID is empty column for each record.for solve this problem i want to use cursor to iterate each record in tbl1, get tbl1.id,parvande, and update tbl2 (set tbl2.tbl1ID where parvande=tbl1.parvande) like this :declare cur1 cursorLOCALFORWARD_ONLYREAD_ONLYfor select id,parvande from tbl1open cur1declare @id uniqueidentifierdeclare @parvande nvarchar(20)fetch next from cur1 into @id,@parvandewhile @@fetch_status = 0begin update tbl2 set tbl1ID = @id where parvande = @parvande fetch next from cur1 into @id,@parvandeendclose cur1deallocate cur1
but after update first record, the following error message display to me :Could not complete cursor operation because the table schema changed after the cursor was declared.
how to solve my problem ?