/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\TCCIT_table.sql **/

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_DG_A301010201_DET') 
 CREATE TABLE T_TCCIT_DG_A301010201_DET (
FID BIGINT DEFAULT 0 NOT NULL,
FTAXACCOUNTSERIALNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FTAXORGID BIGINT DEFAULT 0 NOT NULL,
FSKSSQQ DATETIME,
FSKSSQZ DATETIME,
FBIZNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FTABLE BIGINT DEFAULT 0 NOT NULL,
FAMOUNTFIELD BIGINT DEFAULT 0 NOT NULL,
FTABLETYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FDATATYPE BIGINT DEFAULT 0 NOT NULL,
FDATADIRECTION VARCHAR(50) DEFAULT ' ' NOT NULL,
FAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FFETCHAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FFILTERCONDITION VARCHAR(255) DEFAULT ' ' NOT NULL,
FRULEID BIGINT DEFAULT 0 NOT NULL,
FENTRYTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FITEMNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FABSOLUTE CHAR(1) DEFAULT '0' NOT NULL,
FEXRATE DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_A301010201_DEVE' AND KSQL_COL_NAME ='FRULEID') 
 ALTER TABLE T_TCCIT_A301010201_DEVE ADD (FRULEID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_A301010201_DEVE' AND KSQL_COL_NAME ='FITEMNO') 
 ALTER TABLE T_TCCIT_A301010201_DEVE ADD (FITEMNO BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_A301010201_DEVE' AND KSQL_COL_NAME ='FITEMTYPE') 
 ALTER TABLE T_TCCIT_A301010201_DEVE ADD (FITEMTYPE VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_A301010201_DEVE' AND KSQL_COL_NAME ='FITEMNUMBER') 
 ALTER TABLE T_TCCIT_A301010201_DEVE ADD (FITEMNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_A301010201_DEVE' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_TCCIT_A301010201_DEVE ADD (FNAME VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_A301010201_INCOME' AND KSQL_COL_NAME ='FRULEID') 
 ALTER TABLE T_TCCIT_A301010201_INCOME ADD (FRULEID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_A301010201_INCOME' AND KSQL_COL_NAME ='FITEMNO') 
 ALTER TABLE T_TCCIT_A301010201_INCOME ADD (FITEMNO BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_A301010201_INCOME' AND KSQL_COL_NAME ='FITEMTYPE') 
 ALTER TABLE T_TCCIT_A301010201_INCOME ADD (FITEMTYPE VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_A301010201_INCOME' AND KSQL_COL_NAME ='FITEMNUMBER') 
 ALTER TABLE T_TCCIT_A301010201_INCOME ADD (FITEMNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_A301010201_INCOME' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_TCCIT_A301010201_INCOME ADD (FNAME VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_A301010201_PEOPLE' AND KSQL_COL_NAME ='FRULEID') 
 ALTER TABLE T_TCCIT_A301010201_PEOPLE ADD (FRULEID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_A301010201_PEOPLE' AND KSQL_COL_NAME ='FITEMNO') 
 ALTER TABLE T_TCCIT_A301010201_PEOPLE ADD (FITEMNO BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_A301010201_PEOPLE' AND KSQL_COL_NAME ='FITEMTYPE') 
 ALTER TABLE T_TCCIT_A301010201_PEOPLE ADD (FITEMTYPE VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_A301010201_PEOPLE' AND KSQL_COL_NAME ='FITEMNUMBER') 
 ALTER TABLE T_TCCIT_A301010201_PEOPLE ADD (FITEMNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCCIT_A301010201_PEOPLE' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_TCCIT_A301010201_PEOPLE ADD (FNAME VARCHAR(50) DEFAULT ' ' NOT NULL );

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