转:http://www.cnblogs.com/dannyli/archive/2012/11/29/2794845.html

/************************************************************************************************

**  功能:根据实例ID,删除[K2ServerLog]中的流程实例数据(物理删除,不可恢复,操作前请备份)

**  作者:Danny,Li [xing.dong.li@163.com]

**  日期:2012-11-28

**  版本:v121128

************************************************************************************************

**  返回值        返回值描述

**  ------        --------------------------------------------------------------

**   

**

************************************************************************************************

**  修订日期        修订作者        修订描述

**  ----------    --------    -----------------------------------------------

**   

**   

************************************************************************************************/

USE [K2ServerLog]

GO

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

CREATE PROCEDURE [dbo].[uSP_DeleteK2ServerLogProcInst]

    @procInstID INT        -- Process Instance ID

AS

SET NOCOUNT ON

BEGIN

    PRINT 'Delete process instance from K2ServerLog for ID = '+ CAST(@procInstID AS VARCHAR(50)) +' starting'

   

    DECLARE @iError INT

    SELECT @iError = @@Error

   

    BEGIN TRANSACTION

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _ActInst'

        DELETE _ActInst WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _ActInst'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _ActInstAudit'

        DELETE _ActInstAudit WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _ActInstAudit'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _ActInstDest'

        DELETE _ActInstDest WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _ActInstDest'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _ActInstDestData'

        DELETE _ActInstDestData WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _ActInstDestData'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _ActInstDestDataAudit'

        DELETE _ActInstDestDataAudit WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _ActInstDestDataAudit'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _ActInstDestXml'

        DELETE _ActInstDestXml WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _ActInstDestXml'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _ActInstDestXmlAudit'

        DELETE _ActInstDestXmlAudit WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _ActInstDestXmlAudit'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _EscInst'

        DELETE _EscInst WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _EscInst'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _EventInst'

        DELETE _EventInst WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _EventInst'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _IPC'

        DELETE _IPC WHERE SrcProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _IPC'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _LogBatch'

        DELETE _LogBatch WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _LogBatch'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _LineInst'

        DELETE _LineInst WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _LineInst'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _ProcInst'

        DELETE _ProcInst WHERE ID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _ProcInst'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _ProcInstAudit'

        DELETE _ProcInstAudit WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _ProcInstAudit'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _ProcInstData'

        DELETE _ProcInstData WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _ProcInstData'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _ProcInstDataAudit'

        DELETE _ProcInstDataAudit WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _ProcInstDataAudit'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _ProcInstXml'

        DELETE _ProcInstXml WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _ActInst'

        SELECT @iError = @@ERROR

    END

   

    IF @iError = 0

    BEGIN

        PRINT 'Removing process instance from _ProcInstXmlAudit'

        DELETE _ProcInstXmlAudit WHERE ProcInstID = @procInstID

        PRINT CAST(@@ROWCOUNT AS VARCHAR(10)) + ' records removed from _ProcInstXmlAudit'

        SELECT @iError = @@ERROR

    END

   

    IF @iError <> 0

    BEGIN

        ROLLBACK TRANSACTION

        PRINT 'Delete process instance from K2ServerLog for ID = '+ CAST(@procInstID AS VARCHAR(50)) +' rollback'

    END

    ELSE

    BEGIN

        COMMIT TRANSACTION

        PRINT 'Delete process instance from K2ServerLog for ID = '+ CAST(@procInstID AS VARCHAR(50)) +' commit'

    END

END

K2 Blackpearl中从数据库直接删除流程实例之K2ServerLog表的更多相关文章

  1. K2 Blackpearl中从数据库直接删除流程实例之K2Server表

    转:http://www.cnblogs.com/dannyli/archive/2012/11/29/2794772.html /********************************** ...

  2. EBS中OPM成本更新处理流程及对应的表结构、SLA表

    OPM成本更新流程:  1.跑实际成本处理  功能作用:计算成本  2.成本更新        功能作用:更新成本  3.OPM会计预处理程序->活动->提交流程 功能作用:是创建会计事件 ...

  3. 工作流学习——Activiti流程实例、任务管理四步曲 (zhuan)

    http://blog.csdn.net/zwk626542417/article/details/46646565 ***************************************** ...

  4. Activiti的流程实例及挂起激活(七)

    1.1什么是流程实例 参与者(可以是用户也可以是程序)按照流程定义内容发起一个流程,这就是一个流程实例.是动态的.流程定义和流程实例的图解: 1.2启动流程实例 流程定义部署在 activiti 后, ...

  5. Activiti 流程实例、任务、执行对象及相关的表

    一个流程中,流程实例只有一个,执行对象可以有多个(如果存在分支和聚合) SELECT * FROM activiti.act_ru_execution a;  #正在执行的执行对象表 SELECT * ...

  6. 将数据库中的表注册到K2服务中,并封装为Smart Object

    转:http://www.cnblogs.com/dannyli/archive/2011/08/15/2139550.html K2 blackpearl项目中经常需要将其他数据中的表注册到K2服务 ...

  7. 使用C#代码发起K2 Blackpearl流程

    转:http://www.cnblogs.com/dannyli/archive/2011/08/02/2125285.html 使用C#代码,发起一个K2的流程,其形式和链接SQL Server数据 ...

  8. K2 blackpearl 流程开发(二)

    转:http://blog.csdn.net/gxiangzi/article/details/8444590 本来想一篇文章把流程开发介绍完的,后来发现实在是太多了,只好分成两部分了.上一篇很简单的 ...

  9. K2 blackpearl 流程开发(一)

    转:http://blog.csdn.net/gxiangzi/article/details/8444060 郁闷,今天K2的license过期了,很多东西都没法用了,还得去找PM大大帮忙申请一个. ...

随机推荐

  1. Redis学习总结之二——Redis配置文件(Windows版)

    # Redis configuration file example # Note on units: when memory size is needed, it is possible to sp ...

  2. matlab rand, randn, randi

    rand 生成均匀分布的伪随机数.分布在(0~1)之间 randn 生成标准正态分布的伪随机数(均值为0,方差为1) randi 生成均匀分布的伪随机整数  

  3. Discuz! X2.5RC 全新安装图文教程

    http://www.discuz.net/thread-2660015-1-1.html 一步步教你利用Discuz X2.5建设论坛视频教程(174集) http://down.51cto.com ...

  4. psd文件导出为图片教程

    美术给过来PSD文件好多层啊.怎么挨个把需要的图片导出来呢. 1. 选中 要导出的图片的图层 2.ctrl+N 新建个文档  然后把图片拉到 新的里面 然后点图像-裁剪 确定就行了,然后ctrl+s保 ...

  5. 【转】关于gcc、glibc和binutils模块之间的关系

    原文网址:http://www.mike.org.cn/articles/linux-about-gcc-glibc-and-binutils-the-relationship-between-mod ...

  6. Oracle 使用RMAN COPY 移动 整个数据库 位置 示例

    一.数据迁移说明 在DBA的工作中会遇到数据迁移的情况,比如将本地磁盘迁移到ASM,亦或者需要更换存储设备,那么我就需要迁移整个数据库的存储位置. 如果只是移动表空间或者数据文件,我们可以将表空间或者 ...

  7. 软件设计----LisKov替换原则(LSP)

    LisKov替换原则的定义:一个软件实体如果使用的是一个基类的话,一定适用于其子类,而且根本不能觉察出基类对象和子类对象的区别. 1)怎么理解上面的概念?就是我们程序设计的子类型能够完全替换父类型,而 ...

  8. Data_Structure01-绪论作业

    一.作业题目 仿照三元组或复数的抽象数据类型写出有理数抽象数据类型的描述 (有理数是其分子.分母均为整数且分母不为零的分数). 有理数基本运算: 构造有理数T,元素e1,e2分别被赋以分子.分母值 销 ...

  9. year()+month() 不错的Idear

    year(发货日期)*100+month(发货日期),可以取到年份+月份(月份不到10月的,自动补0)

  10. python 变量 不断 相加 or 相减的简便写法 a +=1

    相加: 相减: