Sql-Server 邮件相关的查询和删除

2018-02-27 08:58:06来源:cnblogs.com作者:皮特胖胖人点击

分享
-- 查询邮件发送记录和报告SELECT TOP(50) * FROM msdb.dbo.sysmail_allitems ORDER BY mailitem_id DESCSELECT 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';GOEXECUTE 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

最新文章

123

最新摄影

闪念基因

微信扫一扫

第七城市微信公众平台