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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_IM_BALANCEINVCALSTEP' AND KSQL_INDNAME = 'IDX_BALCALSTEP_FCALCTYPE') CREATE INDEX IDX_BALCALSTEP_FCALCTYPE ON T_IM_BALANCEINVCALSTEP ( FCALCTYPE );


 EXEC P_ALTERPK 'PK_T_IM_BALANCEINVCALSTEP_L', 'T_IM_BALANCEINVCALSTEP_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_IM_BALANCEINVCALSTEP_L' AND KSQL_INDNAME = 'IDX_BALCALSTEP_L_FLOCAL') CREATE INDEX IDX_BALCALSTEP_L_FLOCAL ON T_IM_BALANCEINVCALSTEP_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_T_IM_BALANCEINVLOGENTRY', 'T_IM_BALANCEINVLOGENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_IM_BALANCEINVLOGENTRY' AND KSQL_INDNAME = 'IDX_BALLOG_ENTRY_FID') CREATE INDEX IDX_BALLOG_ENTRY_FID ON T_IM_BALANCEINVLOGENTRY ( FID );


 EXEC P_ALTERPK 'PK_T_IM_BALANCEINVLOG', 'T_IM_BALANCEINVLOG', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_IM_BALANCEINVLOG' AND KSQL_INDNAME = 'IDX_BALINVLOG_FCALCNUM') CREATE INDEX IDX_BALINVLOG_FCALCNUM ON T_IM_BALANCEINVLOG ( FCALCNUM );



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