/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\EB_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_DATASET') 
 CREATE TABLE T_EB_DATASET (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCATALOG BIGINT DEFAULT 0 NOT NULL,
FMODEL BIGINT DEFAULT 0 NOT NULL,
FCREATOR BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME,
FMODIFIER BIGINT DEFAULT 0 NOT NULL,
FMODIFYDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_DATASETCATALOG') 
 CREATE TABLE T_EB_DATASETCATALOG (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FPARENTID BIGINT DEFAULT 0 NOT NULL,
FLONGNAME NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_DATASETCATALOG_L') 
 CREATE TABLE T_EB_DATASETCATALOG_L (
FPKID NVARCHAR(30) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_DATASETDIM') 
 CREATE TABLE T_EB_DATASETDIM (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FDATASETDIM BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_BIZRULEFORMULAACC') 
 CREATE TABLE T_EB_BIZRULEFORMULAACC (
FPKID BIGINT DEFAULT 0 NOT NULL,
FMEMBERKEY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FACCOUNTID BIGINT DEFAULT 0 NOT NULL,
FRULEID BIGINT DEFAULT 0 NOT NULL,
FDIMENSTIONJSONFIX NCLOB,
FDIMENSTIONJSONVAR NCLOB
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_BIZRULESET') 
 CREATE TABLE T_EB_BIZRULESET (
FID BIGINT DEFAULT 0 NOT NULL,
FMODEL BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FACCOUNTID BIGINT DEFAULT 0 NOT NULL,
FUSESCOPE NCLOB,
FFORMULASTRING NCLOB,
FSTATUS CHAR(1) DEFAULT '1' NOT NULL,
FCREATER BIGINT DEFAULT 0 NOT NULL,
FMODIFIER BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME,
FMODIFYDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_VARMANAGEMENT') 
 CREATE TABLE T_EB_VARMANAGEMENT (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FVARNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FVARTYPE CHAR(1) DEFAULT '0' NOT NULL,
FVARINFO NVARCHAR(255) DEFAULT ' ' NOT NULL,
FPERIODTYPE CHAR(1) DEFAULT '0' NOT NULL,
FOFFSET INT DEFAULT 0 NOT NULL,
FBASEVAR BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FCREATER BIGINT DEFAULT 0 NOT NULL,
FMODIFIER BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_VARMANAGEMENTENTITY') 
 CREATE TABLE T_EB_VARMANAGEMENTENTITY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FMODEL BIGINT DEFAULT 0 NOT NULL,
FDIMENSION BIGINT DEFAULT 0 NOT NULL,
FINFO NVARCHAR(255) DEFAULT ' ' NOT NULL,
FDIMENSIONDETAIL BIGINT DEFAULT 0 NOT NULL
);



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