CREATE PROCEDURE dbo.PicassoExecuterLogCleanup AS
BEGIN
/*
  Created by Kent Johansen, August 2021
*/
  SET NOCOUNT ON
  DECLARE @Days INT

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

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