/**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 ('FUSEORGID')) 
 ALTER TABLE T_BEI_SERVICECONFIG ADD (FUSEORGID 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 ('FCOMPANYID')) 
 ALTER TABLE T_BEI_SERVICECONFIG ADD (FCOMPANYID 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 ('FOPENORGID')) 
 ALTER TABLE T_BEI_SERVICECONFIG ADD (FOPENORGID BIGINT DEFAULT 0 NOT NULL );
 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_BEI_SERVICECONFIG', 'FUSEORG', 'NULL', 'NULL', '1001', 'NULL';

 EXEC p_AlterColumn 'T_BEI_BANKLOG', 'FCTRLSTRATEGY', 'VARCHAR(30)', 'NOT NULL', '1111', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_BANKLOG' AND KSQL_COL_NAME IN ('FUSEORGID')) 
 ALTER TABLE T_BEI_BANKLOG ADD (FUSEORGID 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 ('FCOMPANYID')) 
 ALTER TABLE T_BEI_BANKLOG ADD (FCOMPANYID 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 ('FOPENORGID')) 
 ALTER TABLE T_BEI_BANKLOG ADD (FOPENORGID BIGINT DEFAULT 0 NOT NULL );
 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_BEI_BANKLOG', 'FUSEORG', 'NULL', 'NULL', '1001', 'NULL';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_BANKBALANCE' AND KSQL_COL_NAME IN ('FCOMPANYID')) 
 ALTER TABLE T_BEI_BANKBALANCE ADD (FCOMPANYID BIGINT DEFAULT 0 NOT NULL );
 EXEC p_AlterColumn 'T_BEI_TRANSDETAIL', 'FDETAILID', 'VARCHAR(100)', 'NOT NULL', '1111', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_TRANSDETAIL' AND KSQL_COL_NAME IN ('FCOMPANYID')) 
 ALTER TABLE T_BEI_TRANSDETAIL ADD (FCOMPANYID BIGINT DEFAULT 0 NOT NULL );

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