/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\IM_constraint.sql **/
 EXEC P_ALTERPK 'PK_IM_LOCATIONMOVESN_E', 'T_IM_LOCATIONMOVESN_E', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_LOCAL_DE_FEID') CREATE INDEX IDX_IM_LOCAL_DE_FEID ON T_IM_LOCATIONMOVESN_E ( FDETAILID );

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


 EXEC P_ALTERPK 'PK_IM_LOCATIONTRANSFER', 'T_IM_LOCATIONTRANSFER', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_IM_BILLFIELDSETTING', 'T_IM_BILLFIELDSETTING', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_BSET_FB') CREATE INDEX IDX_IM_BSET_FB ON T_IM_BILLFIELDSETTING ( FBILL );


 EXEC P_ALTERPK 'PK_IM_FIELDSETTINGENTRY', 'T_IM_FIELDSETTINGENTRY', 'FENTRYID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_BSET_E_FFID') CREATE INDEX IDX_IM_BSET_E_FFID ON T_IM_FIELDSETTINGENTRY ( FFULLFIELD );


 EXEC P_ALTERPK 'PK_IM_LOCATIONTRANSFER_L', 'T_IM_LOCATIONTRANSFER_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_IM_INVDBPARAM', 'T_IM_INVDBPARAM', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_IM_LOCATIONTRANSENTRY', 'T_IM_LOCATIONTRANSENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_IM_INVSCHEMES', 'T_IM_INVSCHEMES', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_IVS_FGP') CREATE INDEX IDX_IM_IVS_FGP ON T_IM_INVSCHEMES ( FGROUPID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IM_IVS_FBF') CREATE INDEX IDX_IM_IVS_FBF ON T_IM_INVSCHEMES ( FNUMBER );


 EXEC P_ALTERPK 'PK_IM_INVSCHEMES_L', 'T_IM_INVSCHEMES_L', 'FPKID', '1';

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



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