Clearing the Mail tables instead of Archiving them

Version 5

    Verified Product Versions

    Service Desk 7.6Service Desk 7.7.xService Desk 7.8.xService Desk 2016.xAsset Manager 2016.xService Desk 2017.x

    The attached script can be used to maintain the size of the User Message tables if you do not wish to archive the mail tables using the mail archive scripts.

    The script will not remove rows if they have not been processed by mail manager.


    Before implementing the script please ensure a complete and working backup of your database has been taken.


    Run the attached script against your ITBM database in SQL Query Analyzer.  This will create a stored procedure named sp_MMClear.  You will then need to schedule the stored procedure SP_MMClear to run once each day after the last backup of the day.


    <update 20150924>

    The Script has been updated to use set operations and to overcome some reported foreign key constraints issues reported with version 7.7+