/**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_SERVICECONFIG' AND KSQL_COL_NAME IN ('FDISABLERID')) 
 ALTER TABLE T_BEI_SERVICECONFIG ADD (FDISABLERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_SERVICECONFIG' AND KSQL_COL_NAME IN ('FENABLERID')) 
 ALTER TABLE T_BEI_SERVICECONFIG ADD (FENABLERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_SERVICECONFIG' AND KSQL_COL_NAME IN ('FENABLEDATE')) 
 ALTER TABLE T_BEI_SERVICECONFIG ADD (FENABLEDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_SERVICECONFIG' AND KSQL_COL_NAME IN ('FDISABLEDATE')) 
 ALTER TABLE T_BEI_SERVICECONFIG ADD (FDISABLEDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_BANKLOG' AND KSQL_COL_NAME IN ('FACCOUNTBANK')) 
 ALTER TABLE T_BEI_BANKLOG ADD (FACCOUNTBANK VARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_BANKLOG' AND KSQL_COL_NAME IN ('FDISABLERID')) 
 ALTER TABLE T_BEI_BANKLOG ADD (FDISABLERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_BANKLOG' AND KSQL_COL_NAME IN ('FENABLERID')) 
 ALTER TABLE T_BEI_BANKLOG ADD (FENABLERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_BANKLOG' AND KSQL_COL_NAME IN ('FENABLEDATE')) 
 ALTER TABLE T_BEI_BANKLOG ADD (FENABLEDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_BANKLOG' AND KSQL_COL_NAME IN ('FDISABLEDATE')) 
 ALTER TABLE T_BEI_BANKLOG ADD (FDISABLEDATE DATETIME );
 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_BEI_BANKLOG', 'FBANKACCOUT', 'NULL', 'NULL', '1001', 'NULL';

 EXEC p_AlterColumn 'T_BEI_BANKBALANCE', 'FAMOUNT', 'DECIMAL(19,6)', 'NULL', '0111', 'NULL';

 EXEC p_AlterColumn 'T_BEI_BANKBALANCE', 'FLOCAMT', 'DECIMAL(19,6)', 'NULL', '0111', 'NULL';

 EXEC p_AlterColumn 'T_BEI_BANKBALANCE', 'FVALIBALANCE', 'DECIMAL(19,6)', 'NULL', '0111', 'NULL';

 EXEC p_AlterColumn 'T_BEI_BANKBALANCE', 'FLSTBALANCE', 'DECIMAL(19,6)', 'NULL', '0111', 'NULL';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_BANKBALANCE' AND KSQL_COL_NAME IN ('FEXCHANGERATE')) 
 ALTER TABLE T_BEI_BANKBALANCE ADD (FEXCHANGERATE DECIMAL(23,10) DEFAULT 0 NOT NULL );
 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_BEI_BANKBALANCE', 'FEXCHARGERATE', 'NULL', 'NULL', '1001', 'NULL';

 EXEC p_AlterColumn 'T_BEI_TRANSDETAIL', 'FDEBITAMOUNT', 'DECIMAL(19,6)', 'NULL', '0011', 'NULL';

 EXEC p_AlterColumn 'T_BEI_TRANSDETAIL', 'FCREDITAMOUNT', 'DECIMAL(19,6)', 'NULL', '0011', 'NULL';

 EXEC p_AlterColumn 'T_BEI_TRANSDETAIL', 'FTRANSBALANCE', 'DECIMAL(19,6)', 'NULL', '0011', 'NULL';

 EXEC p_AlterColumn 'T_BEI_TRANSDETAIL', 'FAMOUNT', 'DECIMAL(19,6)', 'NULL', '0111', 'NULL';

 EXEC p_AlterColumn 'T_BEI_TRANSDETAIL', 'FLOCAMT', 'DECIMAL(19,6)', 'NULL', '0111', 'NULL';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_TRANSDETAIL' AND KSQL_COL_NAME IN ('FEXCHANGERATE')) 
 ALTER TABLE T_BEI_TRANSDETAIL ADD (FEXCHANGERATE DECIMAL(23,10) );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_TRANSDETAIL' AND KSQL_COL_NAME IN ('FISREFUND')) 
 ALTER TABLE T_BEI_TRANSDETAIL ADD (FISREFUND CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_TRANSDETAIL' AND KSQL_COL_NAME IN ('FISDEBIT')) 
 ALTER TABLE T_BEI_TRANSDETAIL ADD (FISDEBIT CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_TRANSDETAIL' AND KSQL_COL_NAME IN ('FBANKINTERFACE')) 
 ALTER TABLE T_BEI_TRANSDETAIL ADD (FBANKINTERFACE 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 ('FISRECED')) 
 ALTER TABLE T_BEI_TRANSDETAIL ADD (FISRECED CHAR(1) DEFAULT '0' NOT NULL );
 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_BEI_TRANSDETAIL', 'FEXCHANGEREATE', 'NULL', 'NULL', '1001', 'NULL';


/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest(平台_业务)\pdm\BEI_table.sql **/
