/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BCM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_ADJUSTTMPCOMDIM') 
 CREATE TABLE T_BCM_ADJUSTTMPCOMDIM (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FDIMENSIONID BIGINT DEFAULT 0 NOT NULL,
FMEMBERID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_RPTADJUST' AND KSQL_COL_NAME ='FTEMPLATE') 
 ALTER TABLE T_BCM_RPTADJUST ADD (FTEMPLATE BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_INVELIMTEMPLATE' AND KSQL_COL_NAME ='FPROCESSID') 
 ALTER TABLE T_BCM_INVELIMTEMPLATE ADD (FPROCESSID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_RDATA_CUSTSET' AND KSQL_COL_NAME ='FSCHEMETYPE') 
 ALTER TABLE T_BCM_RDATA_CUSTSET ADD (FSCHEMETYPE VARCHAR(50) DEFAULT 'singleec' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_RDATA_CUSTSET' AND KSQL_COL_NAME ='FSEQ') 
 ALTER TABLE T_BCM_RDATA_CUSTSET ADD (FSEQ INT DEFAULT 0 NOT NULL );

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