Deleting Objects in M-Files

This example shows how deletions propagate and how to retain deletions in SQL for auditing purposes.

Select a Customer in M-Files

SELECT objid, Deleted, Name_Or_Title, update_id FROM mfcustomer WHERE ExternalID = '152';

Delete the Customer in M-Files

EXEC spmfupdatetable @MFTableName = 'MFCustomer', @UpdateMethod = 1, @ObjIDs = '152', @debug = 0;
SELECT objid, Deleted, Name_Or_Title, update_id FROM mfcustomer WHERE ExternalID = '152';

Delete Without Specifying ObjID

EXEC spmfupdatetable @MFTableName = 'MFCustomer', @UpdateMethod = 1, @debug = 0;
SELECT objid, Deleted, Name_Or_Title, update_id FROM mfcustomer WHERE ExternalID = '152';

Retain Deletions in SQL

EXEC spmfupdatetable @MFTableName = 'MFCustomer', @UpdateMethod = 1, @ObjIDs = '152', @RetainDeletions = 1, @debug = 0;
SELECT objid, Deleted, Name_Or_Title, update_id FROM mfcustomer WHERE ExternalID = '152';

Show Entries in Update History Log

DECLARE @UpdateID SMALLINT;
SET @UpdateID = 126;
SELECT * FROM dbo.MFUpdateHistory AS muh WHERE id > @UpdateID;

EXEC dbo.spMFUpdateHistoryShow @Update_ID = @UpdateID, @IsSummary = 1, @UpdateColumn = 0, @Debug = 0;
EXEC dbo.spMFUpdateHistoryShow @Update_ID = @UpdateID, @IsSummary = 0, @UpdateColumn = 3, @Debug = 0;
EXEC dbo.spMFUpdateHistoryShow @Update_ID = @UpdateID, @IsSummary = 0, @UpdateColumn = 6, @Debug = 0;