/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BASE_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SUPPLIERBANK' AND KSQL_COL_NAME ='FBANKACCOUNTTYPE') 
 ALTER TABLE T_BD_SUPPLIERBANK ADD (FBANKACCOUNTTYPE NVARCHAR(120) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SUPPLIERBANK' AND KSQL_COL_NAME ='FSETTLMENT') 
 ALTER TABLE T_BD_SUPPLIERBANK ADD (FSETTLMENT BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SUPPLIERBANK' AND KSQL_COL_NAME ='FCOMMISSIONBEARER') 
 ALTER TABLE T_BD_SUPPLIERBANK ADD (FCOMMISSIONBEARER NVARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SUPPLIERBANK' AND KSQL_COL_NAME ='FLIQUIDATIONPARAM') 
 ALTER TABLE T_BD_SUPPLIERBANK ADD (FLIQUIDATIONPARAM NVARCHAR(125) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SUPPLIERBANK' AND KSQL_COL_NAME ='FAGENTBANK') 
 ALTER TABLE T_BD_SUPPLIERBANK ADD (FAGENTBANK BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SUPPLIER' AND KSQL_COL_NAME ='FPAYMENTCURRENCY') 
 ALTER TABLE T_BD_SUPPLIER ADD (FPAYMENTCURRENCY BIGINT DEFAULT 0 NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SUPPLIERBANK' AND KSQL_COL_NAME ='FAGENTBANKACCOUNT') 
 ALTER TABLE T_BD_SUPPLIERBANK ADD (FAGENTBANKACCOUNT NVARCHAR(80) DEFAULT ' ' NOT NULL );
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_CUSTOMERADDRESS' AND KSQL_COL_NAME ='FRECEIVING') 
 ALTER TABLE T_BD_CUSTOMERADDRESS ADD (FRECEIVING CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_CUSTOMERADDRESS' AND KSQL_COL_NAME ='FINVOICE') 
 ALTER TABLE T_BD_CUSTOMERADDRESS ADD (FINVOICE CHAR(1) DEFAULT '0' NOT NULL );
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_MATERIAL_S' AND KSQL_COL_NAME ='FENABLEMATERIALVERSION') 
 ALTER TABLE T_BD_MATERIAL_S ADD (FENABLEMATERIALVERSION CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_BPUNITCODEREG' AND KSQL_COL_NAME ='FBIZPARTNERID') 
 ALTER TABLE T_BD_BPUNITCODEREG ADD (FBIZPARTNERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_BOMVERSION' AND KSQL_COL_NAME ='FMATERIALID') 
 ALTER TABLE T_BD_BOMVERSION ADD (FMATERIALID BIGINT DEFAULT 0 NOT NULL );

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