/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BEI_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_BANKAGENTPAYBILL' AND KSQL_COL_NAME IN ('FLASTSOURCEBILLID')) 
 ALTER TABLE T_BEI_BANKAGENTPAYBILL ADD (FLASTSOURCEBILLID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_BANKTRANSDOWNBILL' AND KSQL_COL_NAME IN ('FLASTSOURCEBILLID')) 
 ALTER TABLE T_BEI_BANKTRANSDOWNBILL ADD (FLASTSOURCEBILLID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_BANKTRANSUPBILL' AND KSQL_COL_NAME IN ('FLASTSOURCEBILLID')) 
 ALTER TABLE T_BEI_BANKTRANSUPBILL ADD (FLASTSOURCEBILLID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_BANKAGENTPAY_ENTRY' AND KSQL_COL_NAME IN ('FISUPDATESTATE')) 
 ALTER TABLE T_BEI_BANKAGENTPAY_ENTRY ADD (FISUPDATESTATE CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_BANKTRANSDOWN_ENTRY' AND KSQL_COL_NAME IN ('FISUPDATESTATE')) 
 ALTER TABLE T_BEI_BANKTRANSDOWN_ENTRY ADD (FISUPDATESTATE CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_BANKTRANSUP_ENTRY' AND KSQL_COL_NAME IN ('FISUPDATESTATE')) 
 ALTER TABLE T_BEI_BANKTRANSUP_ENTRY ADD (FISUPDATESTATE CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_BANKPAYINGBILL' AND KSQL_COL_NAME IN ('FLASTSOURCEBILLID')) 
 ALTER TABLE T_BEI_BANKPAYINGBILL ADD (FLASTSOURCEBILLID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_BANKPAYINGBILL' AND KSQL_COL_NAME IN ('FISUPDATESTATE')) 
 ALTER TABLE T_BEI_BANKPAYINGBILL ADD (FISUPDATESTATE CHAR(1) DEFAULT '0' NOT NULL );
 EXEC p_AlterColumn 'T_BEI_TRANSDETAIL', 'FRECEREDTYPE', 'VARCHAR(5)', 'NOT NULL', '0001', '''0''';


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