...
Code Block |
---|
|
delete (select sa.* from SHKAssignmentsTable sa
left join SHKProcesses sp on sa.ActivityProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010));
delete sad from SHKAndJoinTable as saj
left join SHKActivities as sac on saj.Activity = sac.oid
left join SHKProcesses as sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
delete sad from SHKDeadlines as sd
left join SHKActivities as sac on sd.Activity = sac.oid
left join SHKProcesses as sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
delete (select sad.* from SHKActivityData sad
left join SHKActivities sac on sad.Activity = sac.oid
left join SHKProcesses sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010));
delete (select sac.* from SHKActivities sac
left join SHKProcesses sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010));
delete (select spd.* from SHKProcessData spd
left join SHKProcesses sp on spd.Process = sp.oid
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010));
delete (select spr.* from SHKProcessRequesters spr
left join SHKProcesses sp on spr.Id = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010));
delete from SHKProcesses where (State = 1000006 or State = 1000008 or State = 1000010); |
To limit the process within a time period for started and completed time, change all the where clause to following and modify the date.
Code Block |
---|
|
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010)
and (FROM_UNIXTIME((Started-StartedTZO)/1000) >= '2020-05-03 00:00:00.000' and FROM_UNIXTIME((Started-StartedTZO)/1000) <= '2020-05-06 23:59:59.999')
and (FROM_UNIXTIME((LastStateTime-LastStateTimeTZO)/1000) >= '2020-05-03 00:00:00.000' and FROM_UNIXTIME((LastStateTime-LastStateTimeTZO)/1000) <= '2020-05-06 23:59:59.999') |
Code Block |
---|
|
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010)
and (DATEADD(s, ((Started-StartedTZO)/1000), '1970-01-01 00:00:00') >= '2020-05-03 00:00:00' and DATEADD(s, ((Started-StartedTZO)/1000), '1970-01-01 00:00:00') <= '2020-05-06 23:59:59')
and (DATEADD(s, ((LastStateTime-LastStateTimeTZO)/1000), '1970-01-01 00:00:00') >= '2020-05-03 00:00:00' and DATEADD(s, ((LastStateTime-LastStateTimeTZO)/1000), '1970-01-01 00:00:00') <= '2020-05-06 23:59:59') |
Code Block |
---|
|
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010)
and (FROM_UNIXTIME((Started-StartedTZO)/1000) >= '2020-05-03 00:00:00' and FROM_UNIXTIME((Started-StartedTZO)/1000) <= '2020-05-06 23:59:59')
and (FROM_UNIXTIME((LastStateTime-LastStateTimeTZO)/1000) >= '2020-05-03 00:00:00' and FROM_UNIXTIME((LastStateTime-LastStateTimeTZO)/1000) <= '2020-05-06 23:59:59') |
If you would like to clean the all the process instances data including the running process instances, you can use the following query.
...