/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest(平台_业务)\pdm\BEI_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_BEI_SERVICECONFIG', 'T_BEI_SERVICECONFIG', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BEI_SERVICECONFIG') CREATE INDEX IDX_BEI_SERVICECONFIG ON T_BEI_SERVICECONFIG ( FNUMBER ,FNAME ,FORGID );


 EXEC P_ALTERPK 'PK_T_BEI_SERVICECONFIG_L', 'T_BEI_SERVICECONFIG_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BEI_SERVICECONFIG_L') CREATE INDEX IDX_BEI_SERVICECONFIG_L ON T_BEI_SERVICECONFIG_L ( FID ,FLOCALEID ,FCOMMENT );


 EXEC P_ALTERPK 'PK_T_BEI_BANKLOG', 'T_BEI_BANKLOG', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BEI_BANKLOG') CREATE INDEX IDX_BEI_BANKLOG ON T_BEI_BANKLOG ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_BEI_BANKLOG_L', 'T_BEI_BANKLOG_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BEI_BANKLOG_L') CREATE INDEX IDX_BEI_BANKLOG_L ON T_BEI_BANKLOG_L ( FID ,FLOCALEID ,FCOMMENT );


 EXEC P_ALTERPK 'PK_T_BEI_BANKLOGEXC', 'T_BEI_BANKLOGEXC', 'FDATAID,FUSEORGID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BEI_BANKLOGEXC_UO') CREATE INDEX IDX_BEI_BANKLOGEXC_UO ON T_BEI_BANKLOGEXC ( FCREATEORGID );


 EXEC P_ALTERPK 'PK_T_BEI_BANKBALANCE_L', 'T_BEI_BANKBALANCE_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BEI_BANKBALANCE_L') CREATE INDEX IDX_BEI_BANKBALANCE_L ON T_BEI_BANKBALANCE_L ( FID ,FLOCALEID ,FDESCRIPTION );


EXEC p_DropIdx 'IDX_BEI_BALANCE', 'T_BEI_BANKBALANCE';
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BEI_BALANCE') CREATE INDEX IDX_BEI_BALANCE ON T_BEI_BANKBALANCE ( FACCOUNTBANKID ,FCURRENCYID ,FBIZDATE );

 EXEC P_ALTERPK 'PK_T_BEI_TRANSDETAIL_L', 'T_BEI_TRANSDETAIL_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BEI_TRANSDETAIL_L') CREATE INDEX IDX_BEI_TRANSDETAIL_L ON T_BEI_TRANSDETAIL_L ( FID ,FLOCALEID ,FDESCRIPTION );


EXEC p_DropIdx 'IDX_TRANSDETAIL_ORG', 'T_BEI_TRANSDETAIL';
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BEI_TRANSDETAIL') CREATE  CLUSTERED INDEX IDX_BEI_TRANSDETAIL ON T_BEI_TRANSDETAIL ( FORGID ,FACCOUNTBANKID ,FBIZTYPE );


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