/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\TCTB_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCTB_TASK_CALCULATE') 
 CREATE TABLE T_TCTB_TASK_CALCULATE (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME,
FMODIFYDATE DATETIME,
FAPPID VARCHAR(36) DEFAULT ' ' NOT NULL,
FNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FTAXTYPECOUNT BIGINT DEFAULT 0 NOT NULL,
FAVGCOSTTIME BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCTB_TASK_DETAIL' AND KSQL_COL_NAME ='FDISPATCHFLAG') 
 ALTER TABLE T_TCTB_TASK_DETAIL ADD (FDISPATCHFLAG VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCTB_TASK_DETAIL' AND KSQL_COL_NAME ='FBATCHNUMBER') 
 ALTER TABLE T_TCTB_TASK_DETAIL ADD (FBATCHNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCTB_TASK_DETAIL' AND KSQL_COL_NAME ='FOPERATER') 
 ALTER TABLE T_TCTB_TASK_DETAIL ADD (FOPERATER BIGINT DEFAULT 0 NOT NULL );

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