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

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_ADJ_FBIZT') CREATE INDEX IDX_IM_ADJ_FBIZT ON T_IM_ADJUSTBILL ( FBIZTIME );

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_ADJ_FBTID') CREATE INDEX IDX_IM_ADJ_FBTID ON T_IM_ADJUSTBILL ( FBIZTYPEID );


 EXEC P_ALTERPK 'PK_IM_ADJUSTBILLENTRY', 'T_IM_ADJUSTBILLENTRY', 'FENTRYID', '1';

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

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


 EXEC P_ALTERPK 'PK_IM_ADJUSTBILLSUBENTRY', 'T_IM_ADJUSTBILLSUBENTRY', 'FDETAILID', '1';

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

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



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