IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[_asignarOTVisitasFijas]') AND type in (N'P', N'PC'))DROP PROCEDURE [dbo].[_asignarOTVisitasFijas]
GO
CREATE PROCEDURE [_asignarOTVisitasFijas]
	@p_id_ot INT,
	@p_visitas VARCHAR(max),
	@p_id_usuario INT
AS
BEGIN

	execute ('
		update cnt_visitaFija
		set 
			fechaModificacion = GETDATE(),
			id_usuario_modifico = ' + @p_id_usuario + ', 
			[id_documento.ot] = ' + @p_id_ot + ' 
		where 
			id in (' + @p_visitas + ')
	')
	select ''
END
