/**Begin D:\PDM_UPGRADE\PDM1\EB_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_USERPARAMETER') 
 CREATE TABLE T_EB_USERPARAMETER (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(30) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FUSERID BIGINT DEFAULT 0 NOT NULL,
FFORMID VARCHAR(50) DEFAULT ' ' NOT NULL,
FDATA NCLOB,
FPARAMTYPE VARCHAR(30) DEFAULT '0' NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FDATASETID BIGINT DEFAULT 0 NOT NULL,
FENABLE VARCHAR(50) DEFAULT '1' NOT NULL,
FSTATUS VARCHAR(50) DEFAULT 'A' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL
);

 EXEC P_ALTERPK 'PK_T_EB_USERPARAMETER', 'T_EB_USERPARAMETER', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_USERPARAMETER_FNUMBER') CREATE INDEX IDX_EB_USERPARAMETER_FNUMBER ON T_EB_USERPARAMETER ( FNUMBER );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_USERPARAMETER_FFORMID') CREATE INDEX IDX_EB_USERPARAMETER_FFORMID ON T_EB_USERPARAMETER ( FFORMID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_USERPARAMETER_FUSERID') CREATE INDEX IDX_EB_USERPARAMETER_FUSERID ON T_EB_USERPARAMETER ( FUSERID );

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


 EXEC P_ALTERPK 'PK_EB_USERPARAMETER_L', 'T_EB_USERPARAMETER_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_USERPARAMETER_L_FID') CREATE INDEX IDX_EB_USERPARAMETER_L_FID ON T_EB_USERPARAMETER_L ( FID ,FLOCALEID );
 

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_ADJDETAIL' AND KSQL_COL_NAME IN ('FBUDGETPERIOD')) 
 ALTER TABLE T_EB_ADJDETAIL ADD (FBUDGETPERIOD BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_ADJUSTBILL' AND KSQL_COL_NAME IN ('FBIZMODELID')) 
 ALTER TABLE T_EB_ADJUSTBILL ADD (FBIZMODELID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_ADJUSTBILL' AND KSQL_COL_NAME IN ('FBGMCONTROLDIM')) 
 ALTER TABLE T_EB_ADJUSTBILL ADD (FBGMCONTROLDIM BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_ADJUSTBILL' AND KSQL_COL_NAME IN ('FDATASETID')) 
 ALTER TABLE T_EB_ADJUSTBILL ADD (FDATASETID BIGINT DEFAULT 0 NOT NULL );

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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_SHAREDIMENSION' AND KSQL_COL_NAME ='FBILLID') 
 ALTER TABLE T_EB_SHAREDIMENSION ADD (FBILLID NVARCHAR(50) DEFAULT ' ' NOT NULL );
/**End D:\PDM_UPGRADE\PDM1\EB_table.sql **/
