/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\POM_constraint.sql **/
 EXEC P_ALTERPK 'PK_POM_MANUSTOCKENTRY', 'T_POM_MANUSTOCKENTRY', 'FDETAILID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_POM_MSE_FSEQ') CREATE INDEX IDX_POM_MSE_FSEQ ON T_POM_MANUSTOCKENTRY ( FSEQ );


 EXEC P_ALTERPK 'PK_POM_MANUSTOCKENTRY_A', 'T_POM_MANUSTOCKENTRY_A', 'FDETAILID', '1';

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


 EXEC P_ALTERPK 'PK_POM_MANUSTOCKENTRY_L', 'T_POM_MANUSTOCKENTRY_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_POM_MSEL_FDETAILID') CREATE INDEX IDX_POM_MSEL_FDETAILID ON T_POM_MANUSTOCKENTRY_L ( FDETAILID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_POM_MFTORDER', 'T_POM_MFTORDER', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_POM_MFTORDERENTRY', 'T_POM_MFTORDERENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_POM_MFTORDERENTRY_E', 'T_POM_MFTORDERENTRY_E', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_POM_MFTORDERENTRY_S', 'T_POM_MFTORDERENTRY_S', 'FENTRYID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_POM_MOES_FCREATETIME') CREATE INDEX IDX_POM_MOES_FCREATETIME ON T_POM_MFTORDERENTRY_S ( FCREATETIME );


 EXEC P_ALTERPK 'PK_POM_MFTORDERENTRY_S_L', 'T_POM_MFTORDERENTRY_S_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_POM_MOESL_FENTRYID') CREATE INDEX IDX_POM_MOESL_FENTRYID ON T_POM_MFTORDERENTRY_S_L ( FENTRYID ,FLOCALEID );



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