/**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_CARRYMAPENTRY' AND KSQL_COL_NAME IN ('FLASTSCENARIO')) 
 ALTER TABLE T_BCM_CARRYMAPENTRY ADD (FLASTSCENARIO BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_CHKFORMULASETTING' AND KSQL_COL_NAME IN ('FISLINK')) 
 ALTER TABLE T_BCM_CHKFORMULASETTING ADD (FISLINK CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_RIGHTINFO' AND KSQL_COL_NAME IN ('FISHASOLAPDATA')) 
 ALTER TABLE T_BCM_RIGHTINFO ADD (FISHASOLAPDATA CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_DIMMEMBCOMBENTRY' AND KSQL_COL_NAME IN ('FISFLOAT')) 
 ALTER TABLE T_BCM_DIMMEMBCOMBENTRY ADD (FISFLOAT CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_DIMMEMBCOMBENTRY' AND KSQL_COL_NAME IN ('FFLOATITEM')) 
 ALTER TABLE T_BCM_DIMMEMBCOMBENTRY ADD (FFLOATITEM NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_DIMMAPINGENTRY' AND KSQL_COL_NAME IN ('FDEFAULTITEMNUMBER')) 
 ALTER TABLE T_BCM_DIMMAPINGENTRY ADD (FDEFAULTITEMNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_CHECKTMPLENTRY' AND KSQL_COL_NAME IN ('FMULTIGAAPID')) 
 ALTER TABLE T_BCM_CHECKTMPLENTRY ADD (FMULTIGAAPID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_MEMBOFDATETYPE') 
 CREATE TABLE T_BCM_MEMBOFDATETYPE (
FID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDIMENSIONID BIGINT DEFAULT 0 NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FSTATUS VARCHAR(5) DEFAULT ' ' NOT NULL,
FENABLE VARCHAR(5) DEFAULT ' ' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FORGID BIGINT DEFAULT 0 NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_INTEGRATESCHEME' AND KSQL_COL_NAME IN ('FADAPTER')) 
 ALTER TABLE T_BCM_INTEGRATESCHEME ADD (FADAPTER NVARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_SRCDIMMEMBENTRY' AND KSQL_COL_NAME IN ('FTARDIMNUMBER')) 
 ALTER TABLE T_BCM_SRCDIMMEMBENTRY ADD (FTARDIMNUMBER VARCHAR(80) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_SRCDIMMEMBENTRY' AND KSQL_COL_NAME IN ('FSRCDIMNUMBER')) 
 ALTER TABLE T_BCM_SRCDIMMEMBENTRY ADD (FSRCDIMNUMBER VARCHAR(80) DEFAULT ' ' NOT NULL );
 --- drop TABLE --------- 请认真检查该脚本 ------------------- 
IF EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_MEMBOFDATTTYPE') 
 DROP TABLE T_BCM_MEMBOFDATTTYPE;


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