DropUnusedWorkflowProcessScheme
Reference
Schema | Name | Type |
---|---|---|
dbo | DropUnusedWorkflowProcessScheme | Procedures |
Uses
Name | Related to |
---|---|
DropUnusedWorkflowProcessScheme | |
WorkflowProcessInstance | |
WorkflowProcessScheme |
Scripts
CREATE PROCEDURE [DropUnusedWorkflowProcessScheme]
AS
BEGIN
DELETE wps FROM WorkflowProcessScheme AS wps
WHERE wps.IsObsolete = 1
AND NOT EXISTS (SELECT * FROM WorkflowProcessInstance wpi WHERE wpi.SchemeId = wps.Id )
RETURN (SELECT COUNT(*)
FROM WorkflowProcessInstance wpi LEFT OUTER JOIN WorkflowProcessScheme wps ON wpi.SchemeId = wps.Id
WHERE wps.Id IS NULL)
END