/**Begin D:\PDM\pdm_upgrade\pdm1\ER2_constraint.sql **/
 EXEC P_ALTERPK 'PK_ER_STAKEHOLDERAFTER', 'T_ER_STAKEHOLDERAFTER', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_STAKEHOLDERAFTER_FK') CREATE INDEX IDX_ER_STAKEHOLDERAFTER_FK ON T_ER_STAKEHOLDERAFTER ( FDETAILID );


 EXEC P_ALTERPK 'PK_ER_STAKEHOLDERBILL', 'T_ER_STAKEHOLDERBILL', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_STAKE_FBILLNO') CREATE INDEX IDX_ER_STAKE_FBILLNO ON T_ER_STAKEHOLDERBILL ( FBILLNO );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_STAKE_FBILLSTATUS') CREATE INDEX IDX_ER_STAKE_FBILLSTATUS ON T_ER_STAKEHOLDERBILL ( FBILLSTATUS );


 EXEC P_ALTERPK 'PK_ER_STAKEHOLDERBILL_TC', 'T_ER_STAKEHOLDERBILL_TC', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_STAKEHOLDERBILL_TC_TID') CREATE INDEX IDX_ER_STAKEHOLDERBILL_TC_TID ON T_ER_STAKEHOLDERBILL_TC ( FTID );


 EXEC P_ALTERPK 'PK_ER_STAKEHOLDERBILL_WB', 'T_ER_STAKEHOLDERBILL_WB', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_STAKEHOLDERBILL_WB_FK') CREATE INDEX IDX_ER_STAKEHOLDERBILL_WB_FK ON T_ER_STAKEHOLDERBILL_WB ( FID );


 EXEC P_ALTERPK 'PK_ER_STAKEHOLDERDETAIL', 'T_ER_STAKEHOLDERDETAIL', 'FDETAILID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_STAKEHOLDERDETAIL_FK') CREATE INDEX IDX_ER_STAKEHOLDERDETAIL_FK ON T_ER_STAKEHOLDERDETAIL ( FID );


 EXEC P_ALTERPK 'PK_ER_STAKERELATEBILL', 'T_ER_STAKERELATEBILL', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_STAKERELATEDBILL_BILLNO') CREATE INDEX IDX_ER_STAKERELATEDBILL_BILLNO ON T_ER_STAKERELATEBILL ( FBILLNO );



/**End D:\PDM\pdm_upgrade\pdm1\ER2_constraint.sql **/
