/**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_CUSTOM_DATASOURCE_L') 
 CREATE TABLE T_TCTB_CUSTOM_DATASOURCE_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME VARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCTB_CUSTOM_ENTRYDATA') 
 CREATE TABLE T_TCTB_CUSTOM_ENTRYDATA (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FENTITYNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FFIELDNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FSUBNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FAMOUNTFIELD CHAR(1) DEFAULT ' ' NOT NULL,
FFILTERFIELD CHAR(1) DEFAULT ' ' NOT NULL,
FORGFIELD CHAR(1) DEFAULT ' ' NOT NULL,
FDATEFIELD CHAR(1) DEFAULT ' ' NOT NULL,
FYEARFIELD CHAR(1) DEFAULT ' ' NOT NULL,
FMOUTHFIELD CHAR(1) DEFAULT ' ' NOT NULL,
FCJTJFIELD CHAR(1) DEFAULT ' ' NOT NULL,
FCJZSFIELD CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCTB_DATASOURCE_GROUP') 
 CREATE TABLE T_TCTB_DATASOURCE_GROUP (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE VARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FISSYSTEM VARCHAR(30) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCTB_DATASOURCE_GROUP_L') 
 CREATE TABLE T_TCTB_DATASOURCE_GROUP_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME VARCHAR(100) DEFAULT ' ' NOT NULL,
FDESC VARCHAR(500) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCTB_CUSTOM_DATASOURCE') 
 CREATE TABLE T_TCTB_CUSTOM_DATASOURCE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE VARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FGROUPID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FCREATEORGID BIGINT DEFAULT 0 NOT NULL,
FUSERORG BIGINT DEFAULT 0 NOT NULL,
FCTRLSTRATEGY VARCHAR(30) DEFAULT ' ' NOT NULL,
FTAXTYPE VARCHAR(500) DEFAULT ' ' NOT NULL,
FFORMENTITY VARCHAR(50) DEFAULT ' ' NOT NULL,
FFORMNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FSUBFORMNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FSUBFORMENTITY VARCHAR(50) DEFAULT ' ' NOT NULL,
FTBTYPE VARCHAR(30) DEFAULT ' ' NOT NULL
);



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