use msdb;
GO
DECLARE @DeleteOlder DATETIME
SET @DeleteOlder = DATEADD(week, -1, CURRENT_TIMESTAMP)--Till Previuos Week
EXECUTE msdb.dbo.sysmail_delete_log_sp @logged_before = @DeleteOlder
EXECUTE msdb.dbo.sysmail_delete_mailitems_sp @sent_before = @DeleteOlder
GO
DECLARE @DeleteOlder DATETIME
SET @DeleteOlder = DATEADD(week, -1, CURRENT_TIMESTAMP)--Till Previuos Week
EXECUTE msdb.dbo.sysmail_delete_log_sp @logged_before = @DeleteOlder
EXECUTE msdb.dbo.sysmail_delete_mailitems_sp @sent_before = @DeleteOlder
No comments:
Post a Comment