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

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

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

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

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


 EXEC P_ALTERPK 'PK_IM_DISASSEMBLEBILL_L', 'T_IM_DISASSEMBLEBILL_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_DISASSEMBLE_L_LOCALE') CREATE INDEX IDX_IM_DISASSEMBLE_L_LOCALE ON T_IM_DISASSEMBLEBILL_L ( FLOCALEID );


 EXEC P_ALTERPK 'PK_IM_DISASSEMBLEENTRY', 'T_IM_DISASSEMBLEENTRY', 'FENTRYID', '1';

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

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


 EXEC P_ALTERPK 'PK_IM_DISASSEMBLESUBENTRY', 'T_IM_DISASSEMBLESUBENTRY', 'FDETAILID', '1';

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

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

EXEC p_DropIdx 'IDX_IM_MRB_FBIZO', 'T_IM_MREQOUTBILL';
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_MREQOUTB_BILLTYPEID') CREATE INDEX IDX_IM_MREQOUTB_BILLTYPEID ON T_IM_MREQOUTBILL ( FBILLTYPEID );

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