/**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_TEMPLATE' AND KSQL_COL_NAME ='FACCOUNTRECLASS') 
 ALTER TABLE T_BCM_TEMPLATE ADD (FACCOUNTRECLASS CHAR(1) DEFAULT '1' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_MEMBERPERM' AND KSQL_COL_NAME ='FMEMBERNAME') 
 ALTER TABLE T_BCM_MEMBERPERM ADD (FMEMBERNAME NVARCHAR(200) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_MEMBERPERM' AND KSQL_COL_NAME ='FUSERNAME') 
 ALTER TABLE T_BCM_MEMBERPERM ADD (FUSERNAME NVARCHAR(200) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_TASKCATALOG' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BCM_TASKCATALOG ADD (FNAME NVARCHAR(500) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_TASKCONF' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BCM_TASKCONF ADD (FNAME NVARCHAR(200) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_SCHEMECATALOG' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BCM_SCHEMECATALOG ADD (FNAME VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_SCHEMECATALOG' AND KSQL_COL_NAME ='FFULLNAME') 
 ALTER TABLE T_BCM_SCHEMECATALOG ADD (FFULLNAME VARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_TEMPLATECATALOG' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BCM_TEMPLATECATALOG ADD (FNAME NVARCHAR(500) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_SRCDIMBASEDATA' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BCM_SRCDIMBASEDATA ADD (FNAME VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_INTEGRATESCHEME' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BCM_INTEGRATESCHEME ADD (FNAME VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_ISPRODUCT' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BCM_ISPRODUCT ADD (FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_ISSCHEME' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BCM_ISSCHEME ADD (FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_CHECKTMPLCATALOG' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BCM_CHECKTMPLCATALOG ADD (FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_ISBASEENTLIST' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BCM_ISBASEENTLIST ADD (FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_ISDIMMAP' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BCM_ISDIMMAP ADD (FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_RPTADJUSTQUERYPLAN' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BCM_RPTADJUSTQUERYPLAN ADD (FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_RPTADJUSTQUERYPLAN' AND KSQL_COL_NAME ='FDESCRIPTION') 
 ALTER TABLE T_BCM_RPTADJUSTQUERYPLAN ADD (FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_ISDIMMAPSRCDEFVAL' AND KSQL_COL_NAME ='FSRCMEMNAME') 
 ALTER TABLE T_BCM_ISDIMMAPSRCDEFVAL ADD (FSRCMEMNAME NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_ISDIMMAPTARGDEFVAL' AND KSQL_COL_NAME ='FTAGMEMNAME') 
 ALTER TABLE T_BCM_ISDIMMAPTARGDEFVAL ADD (FTAGMEMNAME NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_INVRELATIONDEFINE' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BCM_INVRELATIONDEFINE ADD (FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_MERGECONFIG' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BCM_MERGECONFIG ADD (FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_MERGECONFIG' AND KSQL_COL_NAME ='FDESCRIPTION') 
 ALTER TABLE T_BCM_MERGECONFIG ADD (FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_MODELOLAP_RECORD' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BCM_MODELOLAP_RECORD ADD (FNAME VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_MENUBASE' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BCM_MENUBASE ADD (FNAME VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_STRUCTOFENT' AND KSQL_COL_NAME ='FSIMPLENAME') 
 ALTER TABLE T_BCM_STRUCTOFENT ADD (FSIMPLENAME NVARCHAR(50) DEFAULT ' ' NOT NULL );

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