IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[_inactivarConfigContrato]') AND type in (N'P', N'PC'))
begin
exec('
	CREATE PROCEDURE [dbo].[_inactivarConfigContrato] 
		@p_idConfigContrato int,
		@p_fechaInicial smalldatetime
	AS
	BEGIN
	
		SET NOCOUNT ON;

		update cnt_configContrato set active = 0 where id = @p_idConfigContrato
		delete from cnt_visitaFija where id_configContrato = @p_idConfigContrato and [id_documento.ot] = 0 and fecha_ff >= @p_fechaInicial
	
		select '''' as respuesta
	END
')
end
