DECLARE @country NVARCHAR(50) DECLARE @q1 NVARCHAR(50) DECLARE mycursor CURSOR FOR SELECT Country, Q1 FROM tblMTDQ1 OPEN mycursor FETCH NEXT FROM mycursor INTO @country,@q1 WHILE(@@FETCH_status=0) BEGIN UPDATE dbo.tblMTDQ1 SET Growth = RAND()*10000, Budget=RAND()*10000 WHERE Country = @country and Q1= @q1 FETCH NEXT FROM mycursor INTO @country,@q1 END CLOSE mycursor DEALLOCATE mycursor