/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\SBD_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_WAREHOUSEGROUP' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BD_WAREHOUSEGROUP ADD (FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_WAREHOUSEGROUP' AND KSQL_COL_NAME ='FFULLNAME') 
 ALTER TABLE T_BD_WAREHOUSEGROUP ADD (FFULLNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_LOTCODERULE' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BD_LOTCODERULE ADD (FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_LOTCODERULE' AND KSQL_COL_NAME ='FDESCRIPTION') 
 ALTER TABLE T_BD_LOTCODERULE ADD (FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_LOTCODEITEM' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BD_LOTCODEITEM ADD (FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_LOTCODEITEM' AND KSQL_COL_NAME ='FDESCRIPTION') 
 ALTER TABLE T_BD_LOTCODEITEM ADD (FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_INVSTATUS' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BD_INVSTATUS ADD (FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_INVSTATUS' AND KSQL_COL_NAME ='FDESCRIPTION') 
 ALTER TABLE T_BD_INVSTATUS ADD (FDESCRIPTION NVARCHAR(1000) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_OPERATORGROUP' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BD_OPERATORGROUP ADD (FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_OPERATORGROUP' AND KSQL_COL_NAME ='FDESCRIPTION') 
 ALTER TABLE T_BD_OPERATORGROUP ADD (FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_OPERATORGROUPENTRY' AND KSQL_COL_NAME ='FOPERATORNAME') 
 ALTER TABLE T_BD_OPERATORGROUPENTRY ADD (FOPERATORNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_OPERATORGROUPENTRY' AND KSQL_COL_NAME ='FOPERGRPNAME') 
 ALTER TABLE T_BD_OPERATORGROUPENTRY ADD (FOPERGRPNAME NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_LOCATION' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BD_LOCATION ADD (FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_LOCATION' AND KSQL_COL_NAME ='FDESCRIPTION') 
 ALTER TABLE T_BD_LOCATION ADD (FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_WAREHOUSE' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BD_WAREHOUSE ADD (FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_WAREHOUSE' AND KSQL_COL_NAME ='FDESCRIPTION') 
 ALTER TABLE T_BD_WAREHOUSE ADD (FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SBD_TRANSCEIVERTYPE' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_SBD_TRANSCEIVERTYPE ADD (FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SBD_TRANSCEIVERTYPE' AND KSQL_COL_NAME ='FDESCRIPTION') 
 ALTER TABLE T_SBD_TRANSCEIVERTYPE ADD (FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_BIZTYPE' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BD_BIZTYPE ADD (FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_BIZTYPE' AND KSQL_COL_NAME ='FDESCRIPTION') 
 ALTER TABLE T_BD_BIZTYPE ADD (FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_INVTYPE' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BD_INVTYPE ADD (FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_INVTYPE' AND KSQL_COL_NAME ='FDESCRIPTION') 
 ALTER TABLE T_BD_INVTYPE ADD (FDESCRIPTION NVARCHAR(1000) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_MATERIALINVINFO' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BD_MATERIALINVINFO ADD (FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );

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