上次分享过《[URL=http://www.cuiwenyuan.com/shanghai/post/how-to-change-the-process-name-in-flowportal.net-bpm.html]一段在Flowportal.Net BPM中修改流程名称的sql语句[/URL]》,今天再来一段从数据库中永久删除某一指定申请的SQL,这里特指已经在BPM界面上删除过的申请。
第一个Select语句是从已经在BPM界面删除的某一流程的TaskID,然后逐一删除,当然了,你可以写一个In语句把所有的TaskID都传递进去。
<br/><br/>SELECT * <br/>FROM [dbo].[BPMInstTasks]<br/>WHERE ProcessName='ICN'<br/>AND State='Deleted'<br/><br/>declare @TaskID INT <br/>SET @TaskID=12361<br/><br/>--SELECT StepID FROM [dbo].[BPMInstProcSteps] WHERE TaskID = @TaskID<br/><br/>--Snapshot<br/>DELETE FROM [dbo].[BPMSysSnapshot] WHERE TaskID = @TaskID<br/>--Security<br/>DELETE FROM [dbo].[BPMSecurityTACL] WHERE TaskID = @TaskID<br/>--TaskStepLinks<br/>DELETE FROM [dbo].[BPMInstTaskStepLinks] WHERE TaskID = @TaskID<br/>--Tasks<br/>DELETE FROM [dbo].[BPMInstTasks] WHERE TaskID = @TaskID<br/>--Share Tasks<br/>DELETE FROM [dbo].[BPMInstShare] WHERE StepID IN (SELECT StepID FROM [dbo].[BPMInstProcSteps] WHERE TaskID = @TaskID)<br/>--Task Steps<br/>DELETE FROM [dbo].[BPMInstProcSteps] WHERE TaskID = @TaskID<br/>--Routing<br/>DELETE FROM [dbo].[BPMInstRouting] WHERE TaskID = @TaskID<br/>--Links in Email<br/>DELETE FROM [dbo].[BPMInstClickToProcessQuery] WHERE TaskID = @TaskID<br/>
这也还是同样的建议给厂商,一定要做一个永久删除的功能,从数据库中删除掉。