/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\FMM_constraint.sql **/
 EXEC P_ALTERPK 'PK_FMM_ATACHAPTERCLASSIFY', 'T_FMM_ATACHAPTERCLASSIFY', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_FMM_ATACHAPTERCLASSIFY_L', 'T_FMM_ATACHAPTERCLASSIFY_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_FMM_ATACHAPTERNO', 'T_FMM_ATACHAPTERNO', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_FMM_ATACHAPTERNO_L', 'T_FMM_ATACHAPTERNO_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_FMM_READYLEVEL', 'T_FMM_READYLEVEL', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_FMM_RLEVEL_CREATEORG') CREATE INDEX IDX_T_FMM_RLEVEL_CREATEORG ON T_FMM_READYLEVEL ( FCREATEORGID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_FMM_RLEVEL_MASTER') CREATE INDEX IDX_T_FMM_RLEVEL_MASTER ON T_FMM_READYLEVEL ( FMASTERID );


 EXEC P_ALTERPK 'PK_FMM_READYLEVEL_L', 'T_FMM_READYLEVEL_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_FMM_READYLEVELDETAIL', 'T_FMM_READYLEVELDETAIL', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_FMM_READYRULE', 'T_FMM_READYRULE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_FMM_READYRULE_CREATEORG') CREATE INDEX IDX_T_FMM_READYRULE_CREATEORG ON T_FMM_READYRULE ( FCREATEORGID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_FMM_READYRULE_MASTER') CREATE INDEX IDX_T_FMM_READYRULE_MASTER ON T_FMM_READYRULE ( FMASTERID );


 EXEC P_ALTERPK 'PK_FMM_READYRULE_L', 'T_FMM_READYRULE_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_FMM_READYRULEDETAIL', 'T_FMM_READYRULEDETAIL', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_FMM_READYPLAN', 'T_FMM_READYPLAN', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_FMM_READYPLAN_L', 'T_FMM_READYPLAN_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_FMM_READYPLANDETAILE', 'T_FMM_READYPLANDETAILE', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_FMM_READYPLANDETAILP', 'T_FMM_READYPLANDETAILP', 'FENTRYID', '1';

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



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