參考:https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sysmail-delete-mailitems-sp-transact-sqlhttps://docs.microsoft.c ...
-- 查詢郵件發送記錄和報告 SELECT TOP(50) * FROM msdb.dbo.sysmail_allitems ORDER BY mailitem_id DESC SELECT TOP(50) * FROM msdb.dbo.sysmail_event_log ORDER BY log_id DESC -- 刪除指定時間之前的郵件發送記錄和報告 EXECUTE msdb.dbo.sysmail_delete_mailitems_sp @sent_before = '2018-03-01 00:00'; GO EXECUTE msdb.dbo.sysmail_delete_log_sp @logged_before = '2018-03-01 00:00'; GO
參考:
https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sysmail-delete-mailitems-sp-transact-sql
https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sysmail-delete-log-sp-transact-sql