/**Begin D:\PDM_UPGRADE\PDM1\POM_constraint.sql **/
 EXEC P_ALTERPK 'PK_IM_MDC_PRODUCTINBILL_M', 'T_IM_MDC_PRODUCTINBILL_M', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_MDC_PRO_M_FD') CREATE INDEX IDX_IM_MDC_PRO_M_FD ON T_IM_MDC_PRODUCTINBILL_M ( FPRODUCEORG );


 EXEC P_ALTERPK 'PK_IM_MDC_PRODUCTINBILL_L', 'T_IM_MDC_PRODUCTINBILL_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_IM_MDC_PRODUCTINBILL', 'T_IM_MDC_PRODUCTINBILL', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_MDC_PRODUCTINBILL') CREATE INDEX IDX_IM_MDC_PRODUCTINBILL ON T_IM_MDC_PRODUCTINBILL ( FINVSCHEMEID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_MDC_PRBL_IDTN') CREATE INDEX IDX_IM_MDC_PRBL_IDTN ON T_IM_MDC_PRODUCTINBILL ( FORGID ,FBIZTIMES  DESC ,FBILLNO  DESC );


 EXEC P_ALTERPK 'PK_IM_MDC_PRBLENTRY_X', 'T_IM_MDC_PRBLENTRY_X', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_IM_MDC_PRBLENTRY_R', 'T_IM_MDC_PRBLENTRY_R', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_IM_MDC_PRBLENTRY_M', 'T_IM_MDC_PRBLENTRY_M', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_IM_MDC_PRBLENTRY', 'T_IM_MDC_PRBLENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_IM_MDC_MREQOUTBILL_M', 'T_IM_MDC_MREQOUTBILL_M', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_MDC_REQ_DF') CREATE INDEX IDX_IM_MDC_REQ_DF ON T_IM_MDC_MREQOUTBILL_M ( FDOCTYPE );


 EXEC P_ALTERPK 'PK_IM_MDC_MREQOUTBILL_L', 'T_IM_MDC_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_MDC_MREQOUTBILL_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_IM_MDC_MREQOUTBILL', 'T_IM_MDC_MREQOUTBILL', 'FID', '1';

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

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_MRB_FBIZO') CREATE INDEX IDX_IM_MRB_FBIZO ON T_IM_MDC_MREQOUTBILL ( FBILLTYPEID );


 EXEC P_ALTERPK 'PK_IM_MDC_MQBENTRY_R', 'T_IM_MDC_MQBENTRY_R', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_MDC_MTB_FSEID') CREATE INDEX IDX_IM_MDC_MTB_FSEID ON T_IM_MDC_MQBENTRY_R ( FSRCBILLENTRYID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_MDC_MTB_FMEID') CREATE INDEX IDX_IM_MDC_MTB_FMEID ON T_IM_MDC_MQBENTRY_R ( FMAINBILLENTRYID );


 EXEC P_ALTERPK 'PK_T_IM_MDC_MQBENTRY_M', 'T_IM_MDC_MQBENTRY_M', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_MDC_REWQE_FM') CREATE INDEX IDX_IM_MDC_REWQE_FM ON T_IM_MDC_MQBENTRY_M ( FMANUBILL );


 EXEC P_ALTERPK 'PK_IM_MDC_MQBENTRY', 'T_IM_MDC_MQBENTRY', 'FENTRYID', '1';

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

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_MDC_MTB_E_FMMID') CREATE INDEX IDX_IM_MDC_MTB_E_FMMID ON T_IM_MDC_MQBENTRY ( FMATERIALMASTERID );



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