/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\ER_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_ER_EXPENSESHAREBILL_L', 'T_ER_EXPENSESHAREBILL_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_ER_EXPENSESHAREDETAIL', 'T_ER_EXPENSESHAREDETAIL', 'FDETAILID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_EXPENSESHAREDETAIL_FSEQ') CREATE INDEX IDX_ER_EXPENSESHAREDETAIL_FSEQ ON T_ER_EXPENSESHAREDETAIL ( FID ,FSEQ );


 EXEC P_ALTERPK 'PK_T_ER_EXPENSESHARERULE', 'T_ER_EXPENSESHARERULE', 'FDETAILID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_EXPENSESHARERULE_FSEQ') CREATE INDEX IDX_ER_EXPENSESHARERULE_FSEQ ON T_ER_EXPENSESHARERULE ( FID ,FSEQ );


 EXEC P_ALTERPK 'PK_T_ER_EXPENSESHAREWAIT', 'T_ER_EXPENSESHAREWAIT', 'FDETAILID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_EXPENSESHAREWAIT_FSEQ') CREATE INDEX IDX_ER_EXPENSESHAREWAIT_FSEQ ON T_ER_EXPENSESHAREWAIT ( FID ,FSEQ );


 EXEC P_ALTERPK 'PK_T_ER_EXPENSESHAREBILL', 'T_ER_EXPENSESHAREBILL', 'FID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_SHARE_FAPPLIERID') CREATE INDEX IDX_ER_SHARE_FAPPLIERID ON T_ER_EXPENSESHAREBILL ( FAPPLIERID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_SHARE_FCREATORID') CREATE INDEX IDX_ER_SHARE_FCREATORID ON T_ER_EXPENSESHAREBILL ( FCREATORID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_SHARE_FCOMPANYID') CREATE INDEX IDX_ER_SHARE_FCOMPANYID ON T_ER_EXPENSESHAREBILL ( FCOMPANYID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_SHARE_FBIZDATE_FBILLNO') CREATE INDEX IDX_ER_SHARE_FBIZDATE_FBILLNO ON T_ER_EXPENSESHAREBILL ( FBIZDATE ,FBILLNO );

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

 EXEC P_ALTERPK 'PK_T_ER_EXPENSESHAREBILL_TC', 'T_ER_EXPENSESHAREBILL_TC', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_SHAREBILL_TC_FBILLID') CREATE INDEX IDX_ER_SHAREBILL_TC_FBILLID ON T_ER_EXPENSESHAREBILL_TC ( FTBILLID );
 
 EXEC P_ALTERPK 'PK_T_ER_EXPENSESHAREBILL_LK', 'T_ER_EXPENSESHAREBILL_LK', 'FPKID', '1';

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

  EXEC P_ALTERPK 'PK_T_ER_EXPENSESHAREBILL_WB', 'T_ER_EXPENSESHAREBILL_WB', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_SHAREBILL_WB_FID') CREATE INDEX IDX_ER_SHAREBILL_WB_FID ON T_ER_EXPENSESHAREBILL_WB ( FID );
 
  EXEC P_ALTERPK 'PK_T_ER_EXPENSESHAREWAIT_LK', 'T_ER_EXPENSESHAREWAIT_LK', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_SHAREWAIT_LK_FDETAILID') CREATE INDEX IDX_ER_SHAREWAIT_LK_FDETAILID ON T_ER_EXPENSESHAREWAIT_LK ( FDETAILID );
 
/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\ER_constraint.sql **/
