/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\POM_constraint.sql **/
 EXEC P_ALTERPK 'PK_POM_MROSTOCK', 'T_POM_MROSTOCK', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_POM_MROSTOCK_FORDERID') CREATE INDEX IDX_POM_MROSTOCK_FORDERID ON T_POM_MROSTOCK ( FORDERID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_POM_MROSTOCK_FORDERENTRYID') CREATE INDEX IDX_POM_MROSTOCK_FORDERENTRYID ON T_POM_MROSTOCK ( FORDERENTRYID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_POM_MROSTOCK_FSOURCEBILLID') CREATE INDEX IDX_POM_MROSTOCK_FSOURCEBILLID ON T_POM_MROSTOCK ( FSOURCEBILLID );


 EXEC P_ALTERPK 'PK_POM_MROSTOCK_L', 'T_POM_MROSTOCK_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_POM_MROSTOCKENTRY_L', 'T_POM_MROSTOCKENTRY_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_POM_MROSTOCKENTRY', 'T_POM_MROSTOCKENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MROSTOCKEN_FMATMASTERID') CREATE INDEX IDX_MROSTOCKEN_FMATMASTERID ON T_POM_MROSTOCKENTRY ( FMATERIELMASTERID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MROSTOCKEN_FSRCBILLID') CREATE INDEX IDX_MROSTOCKEN_FSRCBILLID ON T_POM_MROSTOCKENTRY ( FSRCBILLID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MROSTOCKEN_FSRCBILLENTRYID') CREATE INDEX IDX_MROSTOCKEN_FSRCBILLENTRYID ON T_POM_MROSTOCKENTRY ( FSRCBILLENTRYID );


 EXEC P_ALTERPK 'PK_POM_MROPROJECTTASK', 'T_POM_MROPROJECTTASK', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_POM_MROORDER', 'T_POM_MROORDER', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_POM_MROORDERENTRY', 'T_POM_MROORDERENTRY', 'FENTRYID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MROORDERENTRY_FTRACKID') CREATE INDEX IDX_MROORDERENTRY_FTRACKID ON T_POM_MROORDERENTRY ( FTRACKNUMBERID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MROORDERENTRY_FCFGCODEID') CREATE INDEX IDX_MROORDERENTRY_FCFGCODEID ON T_POM_MROORDERENTRY ( FCONFIGUREDCODEID );


 EXEC P_ALTERPK 'PK_POM_MROORDERENTRY_E', 'T_POM_MROORDERENTRY_E', 'FENTRYID', '1';

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



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