/**Begin D:\DBA\1.4\PDM_UPGRADE\PDM1\BCM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_DATASOURCECATALOG') 
 CREATE TABLE T_BCM_DATASOURCECATALOG (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(80) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSTATUS CHAR(1) DEFAULT 'A' NOT NULL,
FENABLE CHAR(1) DEFAULT '1' NOT NULL,
FLEVEL BIGINT DEFAULT 0 NOT NULL,
FLONGNUMBER VARCHAR(255) DEFAULT ' ' NOT NULL,
FISLEAF CHAR(1) DEFAULT '0' NOT NULL,
FPARENTID BIGINT DEFAULT 0 NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FFINSTRUCTION NVARCHAR(500) DEFAULT ' ' NOT NULL,
FSEQUENCE INT DEFAULT 0 NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_DATASOURCECATALOG_L') 
 CREATE TABLE T_BCM_DATASOURCECATALOG_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(500) DEFAULT ' ' NOT NULL,
FFINSTRUCTION NVARCHAR(1000) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_ISDATASOURCE') 
 CREATE TABLE T_BCM_ISDATASOURCE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(150) DEFAULT ' ' NOT NULL,
FTYPE CHAR(1) DEFAULT '1' NOT NULL,
FCATALOG BIGINT DEFAULT 0 NOT NULL,
FNAME VARCHAR(200) DEFAULT ' ' NOT NULL,
FTABLENAME VARCHAR(150) DEFAULT ' ' NOT NULL,
FCUSNAME NVARCHAR(200) DEFAULT ' ' NOT NULL,
FSYNSTATUS CHAR(1) DEFAULT '1' NOT NULL,
FREMARK VARCHAR(200) DEFAULT ' ' NOT NULL,
FISCSCHEMA BIGINT DEFAULT 0 NOT NULL,
FCREATOR BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME,
FMODIFIER BIGINT DEFAULT 0 NOT NULL,
FMODIFYDATE DATETIME,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FENABLE CHAR(1) DEFAULT '0' NOT NULL,
FPARENTID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_ISDATASOURCE_L') 
 CREATE TABLE T_BCM_ISDATASOURCE_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FCUSNAME NVARCHAR(400) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_ISDATASOURCEITEM') 
 CREATE TABLE T_BCM_ISDATASOURCEITEM (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FFIELD VARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPCODE VARCHAR(100) DEFAULT ' ' NOT NULL,
FNAME VARCHAR(100) DEFAULT ' ' NOT NULL,
FTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FISBASEDATA CHAR(1) DEFAULT '0' NOT NULL,
FSUBITEM BIGINT DEFAULT 0 NOT NULL,
FSUBITEMTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FISMEASURE CHAR(1) DEFAULT '0' NOT NULL,
FISPRESET CHAR(1) DEFAULT '0' NOT NULL,
FJOINFIELD VARCHAR(100) DEFAULT ' '
);



/**End D:\DBA\1.4\PDM_UPGRADE\PDM1\BCM_table.sql **/
