/**Begin D:\PDM_UPGRADE\PDM1\EB_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_COLLECTIONCONFIG') 
 CREATE TABLE T_EB_COLLECTIONCONFIG (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(100) DEFAULT ' ' NOT NULL,
FENTITY NVARCHAR(1000) DEFAULT ' ' NOT NULL,
FCURRENCY BIGINT DEFAULT 0 NOT NULL,
FBOOKRUNNER BIGINT DEFAULT 0 NOT NULL,
FMODEL BIGINT DEFAULT 0 NOT NULL,
FAPPRECORD BIGINT DEFAULT 0 NOT NULL,
FCREATERID BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME,
FMODIFIER BIGINT DEFAULT 0 NOT NULL,
FMODIFYDATE DATETIME,
FSTATUS CHAR(1) DEFAULT '0' NOT NULL,
FENTITYRANG NCLOB
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_COLLECTIONEXECUTE') 
 CREATE TABLE T_EB_COLLECTIONEXECUTE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSTARTDATE DATETIME,
FENDDATE DATETIME,
FEXECUTEPLAN NVARCHAR(50) DEFAULT ' ' NOT NULL,
FFETCH INT DEFAULT 0 NOT NULL,
FREMIND CHAR(1) DEFAULT '0' NOT NULL,
FLASTTIME CHAR(1) DEFAULT '0' NOT NULL,
FTIMEFIELD INT DEFAULT 0 NOT NULL,
FSETTLEDDAY CHAR(1) DEFAULT '0' NOT NULL,
FMODEL BIGINT DEFAULT 0 NOT NULL,
FCREATERID BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME,
FMODIFIER BIGINT DEFAULT 0 NOT NULL,
FMODIFYDATE DATETIME,
FSTATUS CHAR(1) DEFAULT 'A' NOT NULL,
FJOBID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSCHEDULEID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FEFFDAY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FEXPDAY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDATETIMEFIELD INT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_COLLECTIONRECORD') 
 CREATE TABLE T_EB_COLLECTIONRECORD (
FID BIGINT DEFAULT 0 NOT NULL,
FMODEL BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FAPPNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FAPPNUMBER NVARCHAR(100) DEFAULT ' ' NOT NULL,
FCLOUDNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FCLOUDNUMBER NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDSEQ INT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_COLLECTIONSUPERVISOR') 
 CREATE TABLE T_EB_COLLECTIONSUPERVISOR (
FPKID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_DATAENTITYDIMMAP') 
 CREATE TABLE T_EB_DATAENTITYDIMMAP (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FDIMNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDIMNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDIMMAP BIGINT DEFAULT 0 NOT NULL,
FDIMASSIGN BIGINT DEFAULT 0 NOT NULL,
FFIELDTABLE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FFIELDID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FFIELDNAME NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_DATAENTITYPERIODMAP') 
 CREATE TABLE T_EB_DATAENTITYPERIODMAP (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FACCPERIOD BIGINT DEFAULT 0 NOT NULL,
FSTARTDATE DATETIME,
FENDDATE DATETIME,
FBUDGETPERIOD BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_DATAENTITYYEARMAP') 
 CREATE TABLE T_EB_DATAENTITYYEARMAP (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FACCYEAR NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBUDGETYEAR BIGINT DEFAULT 0 NOT NULL,
FACCYEARID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_EBDIMMEMBERMAP') 
 CREATE TABLE T_EB_EBDIMMEMBERMAP (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(100) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMODEL BIGINT DEFAULT 0 NOT NULL,
FBUSINESSBASEDATA NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDIM NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSTATUS CHAR(1) DEFAULT '0' NOT NULL,
FENABLE CHAR(1) DEFAULT '0' NOT NULL,
FDIMNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FBDNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FBDNAMEEXT NVARCHAR(100) DEFAULT ' ' NOT NULL,
FBUSINESSBASEDATAEXT NVARCHAR(100) DEFAULT ' ' NOT NULL,
FUSEASSISTDATA CHAR(1) DEFAULT '0' NOT NULL,
FISEXITNOLEAF CHAR(1) DEFAULT '0' NOT NULL,
FISFREETYPE CHAR(1) DEFAULT '0' NOT NULL,
FUSEMOREBUSSDATA CHAR(1) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_EBDIMMEMBERMAP_L') 
 CREATE TABLE T_EB_EBDIMMEMBERMAP_L (
FPKID NVARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_EBMEMBERMAP') 
 CREATE TABLE T_EB_EBMEMBERMAP (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FBIZMEMBERID BIGINT DEFAULT 0 NOT NULL,
FBIZNUMBER NVARCHAR(100) DEFAULT ' ' NOT NULL,
FBIZNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDIMMEMBERID BIGINT DEFAULT 0 NOT NULL,
FDIMMEMNUMBER NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDIMMEMNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT '0' NOT NULL,
FRANGE NVARCHAR(100) DEFAULT ' ' NOT NULL,
FBIZNAMEEXT NVARCHAR(100) DEFAULT ' ' NOT NULL,
FBIZNUMBEREXT NVARCHAR(100) DEFAULT ' ' NOT NULL,
FBIZMEMBERIEXTID BIGINT DEFAULT 0 NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_DATALOCK') 
 CREATE TABLE T_EB_DATALOCK (
FID BIGINT DEFAULT 0 NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FYEARID BIGINT DEFAULT 0 NOT NULL,
FCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FVERSIONID BIGINT DEFAULT 0 NOT NULL,
FENTITYID BIGINT DEFAULT 0 NOT NULL,
FPERIODBINARY BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_DATALOCKLOG') 
 CREATE TABLE T_EB_DATALOCKLOG (
FID BIGINT DEFAULT 0 NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FYEARID BIGINT DEFAULT 0 NOT NULL,
FCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FVERSIONID BIGINT DEFAULT 0 NOT NULL,
FENTITYID BIGINT DEFAULT 0 NOT NULL,
FPERIOD NVARCHAR(255) DEFAULT ' ' NOT NULL,
FEXECUTOR BIGINT DEFAULT 0 NOT NULL,
FEXECUTEOPERATION CHAR(1) DEFAULT '0' NOT NULL,
FEXECUTETIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_VIEWMEMBER' AND KSQL_COL_NAME ='FUSE') 
 ALTER TABLE T_EB_VIEWMEMBER ADD (FUSE NVARCHAR(2) DEFAULT ' ' NOT NULL );

/**End D:\PDM_UPGRADE\PDM1\EB_table.sql **/
