Stored Procedures [dbo].[ExpireExecutionLogEntries]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Permissions
TypeActionOwning Principal
GrantExecuteRSExecRole
SQL Script
CREATE PROCEDURE [dbo].[ExpireExecutionLogEntries]
AS
-- -1 means no expiration
if exists (select * from ConfigurationInfo where [Name] = 'ExecutionLogDaysKept' and CAST(CAST(Value as nvarchar) as integer) = -1)
begin
return
end
delete from ExecutionLog
where DateDiff(day, TimeStart, getdate()) >= (select CAST(CAST(Value as nvarchar) as integer) from ConfigurationInfo where [Name] = 'ExecutionLogDaysKept')

GO
GRANT EXECUTE ON  [dbo].[ExpireExecutionLogEntries] TO [RSExecRole]
GO
Uses