Declare @key_pri int
declare doctos cursor for
select comedoc.key_pri from comedoc join cometdo on comedoc.tdo_tdo=cometdo.tdo_tdo where 
FEC_DOC>='20190608'  and comedoc.tdo_tdo='LQ'
OPEN doctos
fetch next from doctos into @key_pri
while (@@FETCH_STATUS=0)
begin
   update comedoc set im3_doc=0 where Key_pri=@key_pri
   fetch next from doctos into @key_pri
end
deallocate doctos

