--- title: "Restoring deleted entities" slug: "restoring-deleted-entities" updated: 2026-10-27T23:12:43Z published: 2026-10-27T23:12:43Z canonical: "ims-handbook.cenosco.com/restoring-deleted-entities" --- > ## Documentation Index > Fetch the complete documentation index at: https://ims-handbook.cenosco.com/llms.txt > Use this file to discover all available pages before exploring further. # Restoring deleted entities ## Step-by-Step Guide to Restore an entity ### 1. Find the Revision Command ID > [!NOTE] > Take Note! > > Revision* tables are soon going to be moved to a different server, so instead of Revision* tables use vwRevision* views. First, you need to find the RevisionCommandId associated with your specific object. In the following example, we retrieve a deleted ECH by its Name. ```sql SELECT rc.RevisionCommandId, rc.ObjectId, rf.FieldName, rf.FieldValue FROM RevisionCommand as rc inner join RevisionField as rf on rf.RevisionCommandId = rc.RevisionCommandId WHERE rc.ActionCommandType = 2 and rc.ObjectType = 'ECH' and rf.FieldName = 'Name' and rf.FieldValue = 'ECHNAME' ``` ### 2. Run the Stored Procedure to Restore the Object Once you have identified the object, follow the stored procedure to restore it. Use the following command and fill in the ObjectTypecode specific to your Object to restore in this case ECH: ```sql EXEC utils.spRestoreObject    @ObjectTypeCode = 'ECH',    @ObjectName = NULL,    @ObjectId = 0000000,    @Debug = 0 ``` This stored procedure restores the ECH object with the specified ObjectId. ### 3. Update the Statistics Finally, update the statistics for the restored Object by executing the following stored procedure: In this example, we’ve taken the ECH statistics but depending on your Object find the correct spUpdate___Statistics. ```sql EXEC spUpdateECHStatistics @ObjectId = 0000000, @Create = 1; ``` This command updates the statistics for the Object with the specified ObjectId.