-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE procedure [dbo].[InsertStopIntoLogFromDtsx]
	-- Add the parameters for the stored procedure here
	@Nome as varchar(100)
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
    UPDATE
		dbo.LOG_ESECUZIONE_PERIODICO
	SET
		Fine = GETDATE()
	WHERE
		Nome = @Nome AND
		Inizio = (
			SELECT
				MAX(Inizio)
			FROM
				LOG_ESECUZIONE_PERIODICO
			WHERE
				Nome = @Nome
		)
END