/**Begin D:\PDM_UPGRADE\PDM1\EB_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_BGCONPROCESSENTRY' AND KSQL_COL_NAME IN ('FWRITEOFFS')) 
 ALTER TABLE T_EB_BGCONPROCESSENTRY ADD (FWRITEOFFS CHAR(1) DEFAULT '0' NOT NULL );

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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_BIZRULESET' AND KSQL_COL_NAME IN ('FMETRICID')) 
 ALTER TABLE T_EB_BIZRULESET ADD (FMETRICID BIGINT DEFAULT 0 NOT NULL );
 

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_BIZRULEGROUPDIS' AND KSQL_COL_NAME IN ('FDATACUBE')) 
 ALTER TABLE T_EB_BIZRULEGROUPDIS ADD (FDATACUBE BIGINT DEFAULT 0 NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_DATETYPETODIM') 
 CREATE TABLE T_EB_DATETYPETODIM (
FID BIGINT DEFAULT 0 NOT NULL,
FDIMENSIONID BIGINT DEFAULT 0 NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FDATETYPEID BIGINT DEFAULT 0 NOT NULL,
FOTHERDIMENSIONID BIGINT DEFAULT 0 NOT NULL,
FDIMNAME NVARCHAR(100) DEFAULT '0' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_BIZMODEL') 
 CREATE TABLE T_EB_BIZMODEL (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) 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,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_DATABIZMODEL') 
 CREATE TABLE T_EB_DATABIZMODEL (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FBIZMODELID BIGINT DEFAULT 0 NOT NULL
);
 
/**End D:\PDM_UPGRADE\PDM1\EB_table.sql **/
