spMFDeleteObjectVersionList¶
Signature¶
EXEC dbo.spMFDeleteObjectVersionList
@TableName = N'MFCustomer',
@Process_ID = 5,
@DeleteWithDestroy = 0,
@ProcessBatch_ID = NULL OUTPUT,
@Debug = 0;
Returns¶
INT: 1 on success; -1 on error.
Parameters¶
- @TableName
Type: NVARCHAR(128)
Required: Yes
Description: Valid class table name (e.g., ‘MFCustomer’).
- @Process_ID
Type: INT
Required: Yes
Description: Set
process_id
to 5 in the change history to include versions for deletion.
- @DeleteWithDestroy
Type: BIT
Required: No (default = 0)
Description: Set to 1 to destroy object versions.
- @ProcessBatch_ID
Type: INT
Required: No (OUTPUT)
Description: ID of the record in
MFProcessBatch
.
- @Debug
Type: SMALLINT
Required: No (default = 0)
Description: Debug level. - 1 = Standard Debug Mode
Purpose¶
Procedure to delete a series of object versions from a list
This procedure is mainly used to remove unwanted versions of objects, especially in scenarios where these versions where created by repetitive integrations.
Prerequisites¶
Set process_id of objects to be deleted in the class table prior to running the delete procedure.
This procedure use the table MFObjectChangeHistory as source. Explore and determine the versions to be deteled using the spmfGetHistory procedure and then to update the Process_id on MFObjectChangeHistory to 1 for the object versions to be included in the deletion.
Warning¶
When the version to be deleted is set to the latest version the process will fail with error status 6.
Examples¶
--check items before setting process_id
SELECT mc.id, mch.id, mc.objid, mch.MFversion, mc.MFVersion, mch.[Process_ID], mch.property_id, mch.property_Value, mch.LastModifiedUTC
FROM [MFCustomer] mc
inner join MFObjectChangeHistory mch
on mc.objid = mch.objid and mc.class_id = mch.class_id
order by lastModifiedUTC
--set process_id object to be deleted
UPDATE MFObjectChangeHistory
SET [Process_ID] = 5
WHERE [ID] = 13
--CHECK MFILES BEFORE DELETING TO SHOW DIFF
Changelog¶
Date |
Author |
Description |
2021-12-20 |
LC |
Add logging and pair connection test with Assembly |
2020-10-06 |
LC |
Add new procedure |