USE [DK_Konventum_20210916_Vxx]
GO

/****** Object:  StoredProcedure [dbo].[PicassoExecuterLogCleanup]    Script Date: 28-09-2021 14:14:48 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO

CREATE PROCEDURE [dbo].[MaillogCleanup] AS
BEGIN
/*
  Created by Roy Nielsen, September 2021
*/
  SET NOCOUNT ON
  DECLARE @Days INT

  SELECT @Days = KeyValue FROM HotelSetup WITH (NOLOCK) WHERE SearchKey = 'PicassoExecuterLogCleanupDays'
  SET @Days = ISNULL(@Days, 90)

  DELETE Maillog
  WHERE DateStamp <= DATEADD(DAY, @Days*-1, GETDATE())  
END
GO


