/**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_BANKPAYINGBILL' AND KSQL_COL_NAME IN ('FSIGNTEXT')) 
 ALTER TABLE T_BEI_BANKPAYINGBILL ADD (FSIGNTEXT VARCHAR(1000) );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_TRANSDETAIL' AND KSQL_COL_NAME IN ('FISTRANSUP')) 
 ALTER TABLE T_BEI_TRANSDETAIL ADD (FISTRANSUP CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_TRANSDETAIL' AND KSQL_COL_NAME IN ('FISTRANSDOWN')) 
 ALTER TABLE T_BEI_TRANSDETAIL ADD (FISTRANSDOWN CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_TRANSDETAIL' AND KSQL_COL_NAME IN ('FISBANKWITHHOLDING')) 
 ALTER TABLE T_BEI_TRANSDETAIL ADD (FISBANKWITHHOLDING CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_TRANSDETAIL' AND KSQL_COL_NAME IN ('FRECEDBILLTYPE')) 
 ALTER TABLE T_BEI_TRANSDETAIL ADD (FRECEDBILLTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_TRANSDETAIL' AND KSQL_COL_NAME IN ('FRECEDBILLNUMBER')) 
 ALTER TABLE T_BEI_TRANSDETAIL ADD (FRECEDBILLNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_TRANSDETAIL' AND KSQL_COL_NAME IN ('FRECEREDTYPE')) 
 ALTER TABLE T_BEI_TRANSDETAIL ADD (FRECEREDTYPE VARCHAR(5) DEFAULT ' ' NOT NULL );
 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_BEI_TRANSDETAIL', 'FORGID', 'NULL', 'NULL', '1001', 'NULL';

 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_BEI_TRANSDETAIL', 'FBASECURRENCYID', 'NULL', 'NULL', '1001', 'NULL';

 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_BEI_TRANSDETAIL', 'FNAME', 'NULL', 'NULL', '1001', 'NULL';

 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_BEI_TRANSDETAIL', 'FLOCAMT', 'NULL', 'NULL', '1001', 'NULL';

 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_BEI_TRANSDETAIL', 'FEXCHANGERATE', 'NULL', 'NULL', '1001', 'NULL';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_BANKAGENTPAY_ENTRY' AND KSQL_COL_NAME IN ('FRECAMOUNT_ENP')) 
 ALTER TABLE T_BEI_BANKAGENTPAY_ENTRY ADD (FRECAMOUNT_ENP NCLOB );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_BANKAGENTPAYBILL' AND KSQL_COL_NAME IN ('FSUBMITTIME')) 
 ALTER TABLE T_BEI_BANKAGENTPAYBILL ADD (FSUBMITTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_BANKAGENTPAYBILL' AND KSQL_COL_NAME IN ('FISSALARY')) 
 ALTER TABLE T_BEI_BANKAGENTPAYBILL ADD (FISSALARY CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_BANKAGENTPAYBILL' AND KSQL_COL_NAME IN ('FPAYSTATE')) 
 ALTER TABLE T_BEI_BANKAGENTPAYBILL ADD (FPAYSTATE NVARCHAR(30) DEFAULT ' ' NOT NULL );

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