/**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_APITUDEINFO') 
 CREATE TABLE T_TCTB_APITUDEINFO (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FSTARTDATE DATETIME,
FENDDATE DATETIME,
FSOCIETYTOTAL BIGINT DEFAULT 0 NOT NULL,
FWORKERTOTAL BIGINT DEFAULT 0 NOT NULL,
FEXPORTTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FCOMPANYTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FAPITUDETYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FSOCIETYTYPE VARCHAR(30) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCTB_CATEGORYINFO') 
 CREATE TABLE T_TCTB_CATEGORYINFO (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FTAXTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FLEVYTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FDEADLINE VARCHAR(30) DEFAULT ' ' NOT NULL,
FTAXPAYERTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FENABLE VARCHAR(30) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCTB_TAX_MAIN') 
 CREATE TABLE T_TCTB_TAX_MAIN (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(100) DEFAULT ' ' NOT NULL,
FMAINCOMPANY VARCHAR(100) DEFAULT ' ' NOT NULL,
FTAXPAYER VARCHAR(100) DEFAULT ' ' NOT NULL,
FUNIFIEDSOCIALCODE VARCHAR(100) DEFAULT ' ' NOT NULL,
FREGISTERTYPE BIGINT DEFAULT 0 NOT NULL,
FREGISTEREDCAPITAL DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREGISTERTIME DATETIME,
FCODEANDNAME BIGINT DEFAULT 0 NOT NULL,
FLEGALPEOPLE VARCHAR(100) DEFAULT ' ' NOT NULL,
FREGISTERADDRESS VARCHAR(50) DEFAULT ' ' NOT NULL,
FREGISTERADDRDETAIL VARCHAR(100) DEFAULT ' ' NOT NULL,
FADMINDIVISIONFIELD VARCHAR(50) DEFAULT ' ' NOT NULL,
FACTUALADDRDETAIL VARCHAR(100) DEFAULT ' ' NOT NULL,
FRETIREDSOLDIERS CHAR(1) DEFAULT ' ' NOT NULL,
FKEYGROUP CHAR(1) DEFAULT ' ' NOT NULL,
FARMYRELATIVES CHAR(1) DEFAULT ' ' NOT NULL,
FMILITARYCADRES CHAR(1) DEFAULT ' ' NOT NULL,
FOTHERS CHAR(1) DEFAULT ' ' NOT NULL,
FACCOUNTINGSTANDARDS VARCHAR(30) DEFAULT ' ' NOT NULL,
FORGID VARCHAR(100) DEFAULT ' ' NOT NULL
);


 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_TCTB_SHAREHOLDER_DETAIL', 'FBASEDATAFIELD', 'NULL', 'NULL', '1001', 'NULL';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCTB_BANK_INFO_DETAIL' AND KSQL_COL_NAME IN ('FOPENDATE')) 
 ALTER TABLE T_TCTB_BANK_INFO_DETAIL ADD (FOPENDATE DATETIME );
 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_TCTB_BANK_INFO_DETAIL', 'FSTARTDATE', 'NULL', 'NULL', '1001', 'NULL';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCTB_ORG_GROUP_DETAIL' AND KSQL_COL_NAME IN ('FCOLLECTORG')) 
 ALTER TABLE T_TCTB_ORG_GROUP_DETAIL ADD (FCOLLECTORG VARCHAR(100) DEFAULT ' ' );

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