declare c_update cursor for
select * from Atlant_M_out_main
order by id_control
open c_update
fetch next from c_update
while control_update <> 1
begin
select * from Atlant_M_out_main
update Atlant_M_out_main
set q_110 = '1', control_update = '1'
where q_110 = '5'
end
close c_update
deallocate c_update
go
Что делать если выдаеёт ошибку - Invalid column name 'control_update'.
Код:
DECLARE
CURSOR c_update IS
SELECT * FROM Atlant_M_out_main
ORDER BY id_control
FOR UPDATE;
CURSOR c_update IS
SELECT * FROM Atlant_M_out_main
ORDER BY id_control
FOR UPDATE;
Код:
declare @control_update varchar(10)
declare c_update cursor for
select control_update from Atlant_M_out_main
order by id_control
open c_update
fetch next from c_update into @control_update
while @control_update <> 1
begin
select * from Atlant_M_out_main
update
Atlant_M_out_main
set
q_110 = '1',
control_update = '1'
where
q_110 = '5'
fetch next from c_update into @control_update
end
close c_update
deallocate c_update
declare c_update cursor for
select control_update from Atlant_M_out_main
order by id_control
open c_update
fetch next from c_update into @control_update
while @control_update <> 1
begin
select * from Atlant_M_out_main
update
Atlant_M_out_main
set
q_110 = '1',
control_update = '1'
where
q_110 = '5'
fetch next from c_update into @control_update
end
close c_update
deallocate c_update