/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\IM_constraint.sql **/
 EXEC P_ALTERPK 'PK_IM_MREQBILL', 'T_IM_MREQBILL', 'FID', '1';

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

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_MRBL_FBOID') CREATE INDEX IDX_IM_MRBL_FBOID ON T_IM_MREQBILL ( FBIZORGID );


 EXEC P_ALTERPK 'PK_IM_MREQBILLENTRY', 'T_IM_MREQBILLENTRY', 'FENTRYID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_MRBL_E_FMID') CREATE INDEX IDX_IM_MRBL_E_FMID ON T_IM_MREQBILLENTRY ( FMATERIALID );


 EXEC P_ALTERPK 'PK_IM_MREQBILLSNENTRY', 'T_IM_MREQBILLSNENTRY', 'FDETAILID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_MRRB_FEID') CREATE INDEX IDX_IM_MRRB_FEID ON T_IM_MREQBILLSNENTRY ( FENTRYID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_MRRB_FSID') CREATE INDEX IDX_IM_MRRB_FSID ON T_IM_MREQBILLSNENTRY ( FSERIALID );


 EXEC P_ALTERPK 'PK_IM_MREQBILL_L', 'T_IM_MREQBILL_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_IM_MREQOUTBILL_L', 'T_IM_MREQOUTBILL_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_IM_TRANSAPPLYENTRY_Y', 'T_IM_TRANSAPPLYENTRY_Y', 'FENTRYID', '1';

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



/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\IM_constraint.sql **/
