/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BCM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_EXPORTFILENAMERULE' AND KSQL_COL_NAME ='FFILERULELS') 
 ALTER TABLE T_BCM_EXPORTFILENAMERULE ADD (FFILERULELS NVARCHAR(500) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_EXPORTFILENAMERULE' AND KSQL_COL_NAME ='FSHEETRULELS') 
 ALTER TABLE T_BCM_EXPORTFILENAMERULE ADD (FSHEETRULELS NVARCHAR(500) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_EXPORTFILENAMERULE' AND KSQL_COL_NAME ='FFILECONNECTSTR') 
 ALTER TABLE T_BCM_EXPORTFILENAMERULE ADD (FFILECONNECTSTR NVARCHAR(50) DEFAULT ' ' NOT NULL );
 
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_RDATA_CUSTSET') 
 CREATE TABLE T_BCM_RDATA_CUSTSET (
FID BIGINT DEFAULT 0 NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(100) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(300) DEFAULT ' ' NOT NULL,
FISSYSTEM CHAR(1) DEFAULT '1' NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_CHECKTMPL' AND KSQL_COL_NAME ='FISSINGLEDC') 
 ALTER TABLE T_BCM_CHECKTMPL ADD (FISSINGLEDC CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_CHECKTMPL' AND KSQL_COL_NAME ='FISLINKAGE') 
 ALTER TABLE T_BCM_CHECKTMPL ADD (FISLINKAGE CHAR(1) DEFAULT '1' NOT NULL );

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