I just learned today new thing,"How to delete old e-mail messages from database mail internal tables with using sysmaildeletemailitems_sp" check out following query.
USE MSDB GO Exec sysmail_delete_mailitems_sp @sent_before ='2011/12/14',@sent_status ='sent' GO
Argumnets: @sentbefore-Delete emails upto the date and time provided,if provided NULL,it indicates all dates. @sentstatus-Delete emails of type specified like sent,unsent,retrying and failed,NULL indicates all status.
Published under: SQL Server Tips · · · ·
Where is this stored procedure kept? I see all the sysmail tables and can run the above stored procedure. But I can't find the stored procedure itself in the msdb database.
MSDN link for more information: sysmaildeletemailitemssp
Well, for reasons I cannot explain, I now see the stored procedures in msdb.