
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_TASKRULEENT' AND KSQL_COL_NAME ='FBIZTYPEID') 
 ALTER TABLE T_HPDI_TASKRULEENT ADD (FBIZTYPEID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_TASKRULEENT' AND KSQL_COL_NAME ='FCOLLARULETYPE') 
 ALTER TABLE T_HPDI_TASKRULEENT ADD (FCOLLARULETYPE VARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_TASKRULEENT' AND KSQL_COL_NAME ='FCOLLARULEID') 
 ALTER TABLE T_HPDI_TASKRULEENT ADD (FCOLLARULEID BIGINT DEFAULT 0 NOT NULL );
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HPDI_TASKARRANGE') 
 CREATE TABLE T_HPDI_TASKARRANGE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FMSGSUBSCRIBERID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FISMODIFY CHAR(1) DEFAULT '0' NOT NULL,
FISIMMEDIATELY CHAR(1) DEFAULT '0' NOT NULL,
FBOID BIGINT DEFAULT 0 NOT NULL,
FISCURRENTVERSION CHAR(1) DEFAULT '0' NOT NULL,
FDATASTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FSOURCEVID BIGINT DEFAULT 0 NOT NULL,
FHISVERSION VARCHAR(10) DEFAULT ' ' NOT NULL,
FCHANGEDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSCENEID BIGINT DEFAULT 0 NOT NULL,
FPOLICYID BIGINT DEFAULT 0 NOT NULL,
FSCHID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HPDI_TASKARRANGE_L') 
 CREATE TABLE T_HPDI_TASKARRANGE_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HPDI_TASKARRANGEENT') 
 CREATE TABLE T_HPDI_TASKARRANGEENT (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FEXECUTESEQ INT DEFAULT 0 NOT NULL,
FISSTOPWHENFAIL CHAR(1) DEFAULT '0' NOT NULL,
FENTRYBOID BIGINT DEFAULT 0 NOT NULL,
FISMANUALVERIFY CHAR(1) DEFAULT '0' NOT NULL,
FRULEDESIGNID BIGINT DEFAULT 0 NOT NULL,
FBIZTYPEID BIGINT DEFAULT 0 NOT NULL,
FCOLLARULETYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FCOLLARULEID BIGINT DEFAULT 0 NOT NULL
);