


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HPDI_TASKCENTERENT') 
 CREATE TABLE T_HPDI_TASKCENTERENT (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FPAYROLLACTGID BIGINT DEFAULT 0 NOT NULL,
FPAYROLLACTGVID BIGINT DEFAULT 0 NOT NULL,
FSTOPEXECAFTERFAIL CHAR(1) DEFAULT '0' NOT NULL,
FTASKEXECUTESTATUSENT CHAR(1) DEFAULT '0' NOT NULL,
FEXECUTEFAILMSGENT VARCHAR(2000) DEFAULT '0' NOT NULL,
FTASKEXECUTETIME DATETIME,
FTASKEXECMANNER VARCHAR(10) DEFAULT ' ' NOT NULL,
FTASKEXECUSERID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_TASKCENTER' AND KSQL_COL_NAME ='FTASKRULEVID') 
 ALTER TABLE T_HPDI_TASKCENTER ADD (FTASKRULEVID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_TASKCENTER' AND KSQL_COL_NAME ='FTASKEXECUTENUM') 
 ALTER TABLE T_HPDI_TASKCENTER ADD (FTASKEXECUTENUM INT DEFAULT 0 NOT NULL );


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_TASKRULEENT' AND KSQL_COL_NAME ='FSTOPEXECAFTERFAIL') 
 ALTER TABLE T_HPDI_TASKRULEENT ADD (FSTOPEXECAFTERFAIL CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_PAYROLLACTG' AND KSQL_COL_NAME ='FSOURCEDATAID') 
 ALTER TABLE T_HPDI_PAYROLLACTG ADD (FSOURCEDATAID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_PAYROLLACTG' AND KSQL_COL_NAME ='FBITINDEX') 
 ALTER TABLE T_HPDI_PAYROLLACTG ADD (FBITINDEX BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_PAYROLLACTG' AND KSQL_COL_NAME ='FSOURCEBITINDEX') 
 ALTER TABLE T_HPDI_PAYROLLACTG ADD (FSOURCEBITINDEX BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_PAYROLLACTG' AND KSQL_COL_NAME ='FISMODIFY') 
 ALTER TABLE T_HPDI_PAYROLLACTG ADD (FISMODIFY CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_PAYROLLACTG' AND KSQL_COL_NAME ='FSCENEID') 
 ALTER TABLE T_HPDI_PAYROLLACTG ADD (FSCENEID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_PAYROLLACTG' AND KSQL_COL_NAME ='FPOLICYID') 
 ALTER TABLE T_HPDI_PAYROLLACTG ADD (FPOLICYID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_TASKRULE' AND KSQL_COL_NAME ='FISMODIFY') 
 ALTER TABLE T_HPDI_TASKRULE ADD (FISMODIFY CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_TASKRULE' AND KSQL_COL_NAME ='FEXECPLANJSON') 
 ALTER TABLE T_HPDI_TASKRULE ADD (FEXECPLANJSON VARCHAR(1000) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_TASKRULE' AND KSQL_COL_NAME ='FJOBID') 
 ALTER TABLE T_HPDI_TASKRULE ADD (FJOBID VARCHAR(36) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_TASKRULE' AND KSQL_COL_NAME ='FSCHEDULEID') 
 ALTER TABLE T_HPDI_TASKRULE ADD (FSCHEDULEID VARCHAR(36) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_TASKRULE' AND KSQL_COL_NAME ='FIMMEDIATELY') 
 ALTER TABLE T_HPDI_TASKRULE ADD (FIMMEDIATELY CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_TASKRULE' AND KSQL_COL_NAME ='FSOURCEDATAID') 
 ALTER TABLE T_HPDI_TASKRULE ADD (FSOURCEDATAID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_TASKRULE' AND KSQL_COL_NAME ='FBITINDEX') 
 ALTER TABLE T_HPDI_TASKRULE ADD (FBITINDEX INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_TASKRULE' AND KSQL_COL_NAME ='FSOURCEBITINDEX') 
 ALTER TABLE T_HPDI_TASKRULE ADD (FSOURCEBITINDEX INT DEFAULT 0 NOT NULL );



/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\HPDI_table.sql **/
