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

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

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


 EXEC P_ALTERPK 'PK_POM_XMANUSTOCKENTRY_A', 'T_POM_XMANUSTOCKENTRY_A', 'FDETAILID', '1';

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


 EXEC P_ALTERPK 'PK_POM_XMANUSTOCKENTRY_B', 'T_POM_XMANUSTOCKENTRY_B', 'FDETAILID', '1';

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


 EXEC P_ALTERPK 'PK_POM_XMANUSTOCKENTRY_L', 'T_POM_XMANUSTOCKENTRY_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_POM_XMFTORDER', 'T_POM_XMFTORDER', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_POM_XMFTORDERENTRY', 'T_POM_XMFTORDERENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_POM_XMFTORDERENTRY_E', 'T_POM_XMFTORDERENTRY_E', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_POM_XMFTORDERENTRY_S', 'T_POM_XMFTORDERENTRY_S', 'FENTRYID', '1';

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

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


 EXEC P_ALTERPK 'PK_POM_XMFTORDERENTRY_S_L', 'T_POM_XMFTORDERENTRY_S_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_POM_XMFTORDERLOG', 'T_POM_XMFTORDERLOG', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_POM_XMFTORDERLOG_FK') CREATE INDEX IDX_POM_XMFTORDERLOG_FK ON T_POM_XMFTORDERLOG ( FXBILLID );


 EXEC P_ALTERPK 'PK_POM_XMFTSTOCKLOG', 'T_POM_XMFTSTOCKLOG', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_POM_XMFTSTOCKLOG_FK') CREATE INDEX IDX_POM_XMFTSTOCKLOG_FK ON T_POM_XMFTSTOCKLOG ( FXBILLID );



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