
declare @StrIdDocumento char(25)

declare SysCurDocumentos cursor for 
	select StrIdDocumento 
		from Merlin_MovimientoDocumentosFacturacion_Enc
		where StrIdDocumento like '%ZF%'
			and NumDocumentonumero in (3828,3843,3842,3840,3837,3836,3835,3848,3847,3846,3845,3827)
open SysCurDocumentos 
fetch next from SysCurDocumentos into @StrIdDocumento
while @@FETCH_STATUS = 0 begin 
	exec Merlin_Sp_IOKernel_ProporcionarRetenciones @StrIdDocumento 
	fetch next from SysCurDocumentos into @StrIdDocumento
end 
close SysCurDocumentos
deallocate SysCurDocumentos
