/**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_INTEGRATION_MAPDIM' AND KSQL_COL_NAME ='FDIMATTR') 
 ALTER TABLE T_EB_INTEGRATION_MAPDIM ADD (FDIMATTR NVARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_TASKVARIABLESET') 
 CREATE TABLE T_EB_TASKVARIABLESET (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FDIMENSION BIGINT DEFAULT 0 NOT NULL,
FVARIABLENUMBER BIGINT DEFAULT 0 NOT NULL,
FVARIABLE NVARCHAR(200) DEFAULT ' ' NOT NULL,
FVARIABLEJSONTEXT NCLOB
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_ADJUSTPROJECT' AND KSQL_COL_NAME ='FBIZMODELID') 
 ALTER TABLE T_EB_ADJUSTPROJECT ADD (FBIZMODELID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_ADJUSTPROJECT' AND KSQL_COL_NAME ='FDATASETID') 
 ALTER TABLE T_EB_ADJUSTPROJECT ADD (FDATASETID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_ADJUSTPROJECT' AND KSQL_COL_NAME ='FMETRICID') 
 ALTER TABLE T_EB_ADJUSTPROJECT ADD (FMETRICID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_DATAPERMVERSION') 
 CREATE TABLE T_EB_DATAPERMVERSION (
FID BIGINT DEFAULT 0 NOT NULL,
FUSER BIGINT DEFAULT 0 NOT NULL,
FDIMENSION BIGINT DEFAULT 0 NOT NULL,
FBIZRANGE BIGINT DEFAULT 0 NOT NULL,
FVERSION BIGINT DEFAULT 0 NOT NULL
);
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_BIZRULESET' AND KSQL_COL_NAME ='FOFFSETSUCCESSORS') 
 ALTER TABLE T_EB_BIZRULESET ADD (FOFFSETSUCCESSORS NCLOB );


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