/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\EB_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_DATAPERM' AND KSQL_COL_NAME ='FBUSINESSMODEL') 
 ALTER TABLE T_EB_DATAPERM ADD (FBUSINESSMODEL BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_OFFSETRULECATALOG' AND KSQL_COL_NAME ='FBUSMODELID') 
 ALTER TABLE T_EB_OFFSETRULECATALOG ADD (FBUSMODELID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_OFFSETENTRY' AND KSQL_COL_NAME ='FBUSMODELID') 
 ALTER TABLE T_EB_OFFSETENTRY ADD (FBUSMODELID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_OFFSETRULE' AND KSQL_COL_NAME ='FBUSMODELID') 
 ALTER TABLE T_EB_OFFSETRULE ADD (FBUSMODELID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_BIZRULESETREF') 
 CREATE TABLE T_EB_BIZRULESETREF (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FREFDIMENSION BIGINT DEFAULT 0 NOT NULL,
FREFMEMBER BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_VIEWMEMBER' AND KSQL_COL_NAME ='FMERGERNODE') 
 ALTER TABLE T_EB_VIEWMEMBER ADD (FMERGERNODE CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_VIEWMEMBER' AND KSQL_COL_NAME ='FISINNERORG') 
 ALTER TABLE T_EB_VIEWMEMBER ADD (FISINNERORG CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_VIEWMEMBER' AND KSQL_COL_NAME ='FISOUTERORG') 
 ALTER TABLE T_EB_VIEWMEMBER ADD (FISOUTERORG CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_VIEWMEMBER' AND KSQL_COL_NAME ='FISOFFSETENTRY') 
 ALTER TABLE T_EB_VIEWMEMBER ADD (FISOFFSETENTRY CHAR(1) DEFAULT '0' NOT NULL );

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