/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest(平台_业务)\pdm\TCTB_table.sql **/
 EXEC p_AlterColumn 'T_TCTB_ORG_GROUP_L', 'FPKID', 'VARCHAR(36)', 'NOT NULL', '1111', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCTB_APTITUDE' AND KSQL_COL_NAME IN ('FTYPE2')) 
 ALTER TABLE T_TCTB_APTITUDE ADD (FTYPE2 VARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCTB_BANK_INFO') 
 CREATE TABLE T_TCTB_BANK_INFO (
FID BIGINT DEFAULT 0 NOT NULL,
FORGID VARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCTB_BANK_INFO_DETAIL') 
 CREATE TABLE T_TCTB_BANK_INFO_DETAIL (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FBANKACCT VARCHAR(100) DEFAULT ' ' NOT NULL,
FACCTNAME VARCHAR(100) DEFAULT ' ' NOT NULL,
FBANKNAME VARCHAR(100) DEFAULT ' ' NOT NULL,
FSTARTDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCTB_SHAREHOLDER') 
 CREATE TABLE T_TCTB_SHAREHOLDER (
FID BIGINT DEFAULT 0 NOT NULL,
FORGID VARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCTB_SHAREHOLDER_DETAIL') 
 CREATE TABLE T_TCTB_SHAREHOLDER_DETAIL (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FNAME VARCHAR(100) DEFAULT ' ' NOT NULL,
FIDTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FIDNUMBER VARCHAR(100) DEFAULT ' ' NOT NULL,
FINVESTRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FNATIONALITY VARCHAR(100) DEFAULT ' ' NOT NULL,
FTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FSTARTDATE DATETIME,
FINSTO DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBASEDATAFIELD BIGINT DEFAULT 0 NOT NULL
);



/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest(平台_业务)\pdm\TCTB_table.sql **/
