
RemoveDanglingInstances Usage Examples
The stored procedure can receive four parameters:
| Parameter | Description |
|---|
@ActivityName nvarchar(128) | Specifies the name of the incomplete activity instance to remove. |
@ActivityId nvarchar(128) | (Optional) Specifies that the stored procedure remove only the dangling instance with the specified instance identifier. |
@DateThreshold datetime | (Optional) Specifies that all the active instances in the active table that are older (not equal to and older, only older) than the given date are removed. |
@NewTableExtension nvarchar(30) | (Optional) Specifies that the stored procedure creates three new tables by concatenating the supplied extension to the existing activity tables.
The resulting tables will be:
bam_ActivityName_Active_<Extension>
bam_ActivityName_ActiveRelationships_<Extension>
bam_ActivityName_Continuations_<Extension>
The incomplete instances are moved to the new tables rather than being purged from the database.
If the tables already exist, the stored procedure reuses them; otherwise they are created.
Important If the tables already exist, the stored procedure assumes that their schemas match the ones that would be used if they were created. If a schema does not match, the stored procedure will fail to insert the records and the remove operation will fail. |
exec RemoveDanglingInstances @ActivityName = 'PurchaseOrder'
Removes all active instances of the 'PurchaseOrder' activity in the active, active relationships, and continuations tables.
exec RemoveDanglingInstances @ActivityName = 'PurchaseOrder', @ActivityId = 'PO220567'
Removes only the activity instance that has an Activity ID of 'PO220567' from the active, active relationships, and continuations tables for the 'PurchaseOrder' activity.
exec RemoveDanglingInstances @ActivityName = 'PurchaseOrder', @DateThreshold='2005-02-02 19:27:03:533'
Removes all the activity instances that have a LastModified time that is older than Feb 2nd, 2005 7:27:03.533 PM from the active, active relationships, and continuations tables for the 'PurchaseOrder' activity.
exec RemoveDanglingInstances @ActivityName = 'PurchaseOrder', @ActivityId = 'PO220567', @DateThreshold='2005-02-02 19:27:03:533'
Removes the activity instance whose activity ID is PO220567 only if its LastModified column is older than Feb 2nd, 2005 7:27:03.533 PM.
exec RemoveDanglingInstances @ActivityName = 'PurchaseOrder', @DateThreshold='2005-02-02 19:27:03:533', @NewTableExtension=N'Dangling'
Creates the following tables in the database:
bam_PurchaseOrder_Active_Dangling
bam_PurchaseOrder_ActiveRelationships_Dangling
bam_PurchaseOrder_Continuations_Dangling
The stored procedure copies all incomplete activity instances that are older than Feb 2nd, 2005 7:27:03.533 PM from the active, active relationships, and continuations tables for the 'PurchaseOrder' activity, and inserts them into the newly created tables. The copied activity instances are then removed from the active, active relationships, and continuations tables.