/**Begin D:\PDM_UPGRADE\PDM1\BEI_constraint.sql **/
EXEC p_DropIdx 'IDX_BEI_ELECSTATEMENT', 'T_BEI_ELECSTATEMENT';
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BEI_ELECSTATEMENT') CREATE INDEX IDX_BEI_ELECSTATEMENT ON T_BEI_ELECSTATEMENT ( FCURRENCYID ,FACCOUNTBANKID ,FPERIOD );

 EXEC P_ALTERPK 'PK_T_BEI_ELECSTATEMENT_B', 'T_BEI_ELECSTATEMENT_B', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BEI_ELECSTATE_B_SNO') CREATE INDEX IDX_BEI_ELECSTATE_B_SNO ON T_BEI_ELECSTATEMENT_B ( FSTATENO );


 EXEC P_ALTERPK 'PK_T_BEI_ORGPROTOCOL', 'T_BEI_ORGPROTOCOL', 'FID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BEI_ORGPROTOCOL_ORG') CREATE INDEX IDX_BEI_ORGPROTOCOL_ORG ON T_BEI_ORGPROTOCOL ( FORGID );


 EXEC P_ALTERPK 'PK_T_BEI_ORGPROTOCOL_L', 'T_BEI_ORGPROTOCOL_L', 'FPKID', '1';

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



/**End D:\PDM_UPGRADE\PDM1\BEI_constraint.sql **/