/**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_STRUCTOFENTPART' AND KSQL_COL_NAME ='FISOUTERORG') 
 ALTER TABLE T_BCM_STRUCTOFENTPART ADD (FISOUTERORG CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_ANALYSOLUPAGEDIM' AND KSQL_COL_NAME ='FDIMMEM') 
 ALTER TABLE T_BCM_ANALYSOLUPAGEDIM ADD (FDIMMEM NVARCHAR(200) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_ANALYSOLUCOLUMNDIM' AND KSQL_COL_NAME ='FDIMMEM') 
 ALTER TABLE T_BCM_ANALYSOLUCOLUMNDIM ADD (FDIMMEM NVARCHAR(200) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_ANALYSOLUROWDIM' AND KSQL_COL_NAME ='FDIMMEM') 
 ALTER TABLE T_BCM_ANALYSOLUROWDIM ADD (FDIMMEM NVARCHAR(200) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_DIMENSIONMAPNEW' AND KSQL_COL_NAME ='FID') 
 ALTER TABLE T_BCM_DIMENSIONMAPNEW ADD (FID BIGINT DEFAULT 0 NOT NULL );
 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_BCM_DIMENSIONMAPNEW', 'ID', 'NULL', 'NULL', '1001', 'NULL';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_INVELIMTEMPLATE' AND KSQL_COL_NAME ='FADJUSTMENT') 
 ALTER TABLE T_BCM_INVELIMTEMPLATE ADD (FADJUSTMENT CHAR(1) DEFAULT '0' NOT NULL );
 EXEC p_AlterColumn 'T_BCM_ISGROUPSRCEXPRENTRY', 'FEXPRESSIONS', 'NCLOB', 'NULL', '1111', 'NULL';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_BIZRULEVERSION' AND KSQL_COL_NAME ='FDEBUG') 
 ALTER TABLE T_BCM_BIZRULEVERSION ADD (FDEBUG NCLOB );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_BIZRULEVERSION' AND KSQL_COL_NAME ='FRUNSTATUS') 
 ALTER TABLE T_BCM_BIZRULEVERSION ADD (FRUNSTATUS CHAR(1) DEFAULT '1' NOT NULL );

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