/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\AP_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_AP_TOLERANCERANGE', 'T_AP_TOLERANCERANGE', 'FDETAILID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_AP_TOLERANCERANGE' AND KSQL_INDNAME = 'IDX_AP_TOLERANCERANGE_FENTRYID') CREATE INDEX IDX_AP_TOLERANCERANGE_FENTRYID ON T_AP_TOLERANCERANGE ( FENTRYID );


 EXEC P_ALTERPK 'PK_T_AP_TOLERANCERULEENTRY', 'T_AP_TOLERANCERULEENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_AP_TOLERANCESCHEME', 'T_AP_TOLERANCESCHEME', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_AP_TOLERANCESCHEME' AND KSQL_INDNAME = 'IDX_AP_TOLERANCESCHEME_NUMBER') CREATE INDEX IDX_AP_TOLERANCESCHEME_NUMBER ON T_AP_TOLERANCESCHEME ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_AP_TOLERANCESCHEME_L', 'T_AP_TOLERANCESCHEME_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_AP_TOLERANCETYPE', 'T_AP_TOLERANCETYPE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_AP_TOLERANCETYPE' AND KSQL_INDNAME = 'IDX_AP_TOLERANCETYPE_FUNMBER') CREATE INDEX IDX_AP_TOLERANCETYPE_FUNMBER ON T_AP_TOLERANCETYPE ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_AP_TOLERANCETYPE_L', 'T_AP_TOLERANCETYPE_L', 'FPKID', '1';

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



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