/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BASE_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_BD_PROCESSSEQENTRY', 'T_BD_PROCESSSEQENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'INDEX_BD_PROCESSSEQENTRY') CREATE INDEX INDEX_BD_PROCESSSEQENTRY ON T_BD_PROCESSSEQENTRY ( FID ,FPROCESSSEQ );


 EXEC P_ALTERPK 'PK_T_BD_PROSEQRELATION', 'T_BD_PROSEQRELATION', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'INDEX_BD_PROSEQRELATION') CREATE INDEX INDEX_BD_PROSEQRELATION ON T_BD_PROSEQRELATION ( FID ,FSEQRELATIONSEQ );


 EXEC P_ALTERPK 'PK_T_BD_ROUTER', 'T_BD_ROUTER', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'INDEX_BD_ROUTER') CREATE INDEX INDEX_BD_ROUTER ON T_BD_ROUTER ( FCREATEORGID ,FPROCESSTYPE );


 EXEC P_ALTERPK 'PK_T_BD_ROUTER_L', 'T_BD_ROUTER_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_BD_ROUTERACTENTRY', 'T_BD_ROUTERACTENTRY', 'FDETAILID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'INDEX_BD_ROUTERACTETY') CREATE INDEX INDEX_BD_ROUTERACTETY ON T_BD_ROUTERACTENTRY ( FENTRYID ,FOPERATIONNUMBER );


 EXEC P_ALTERPK 'PK_T_BD_ROUTERPROCESSENTRY', 'T_BD_ROUTERPROCESSENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'INDEX_BD_RUTPROCESSET') CREATE INDEX INDEX_BD_RUTPROCESSET ON T_BD_ROUTERPROCESSENTRY ( FID ,FPARENTID );


 EXEC P_ALTERPK 'PK_T_BD_ROUTERSUBENTRY', 'T_BD_ROUTERSUBENTRY', 'FDETAILID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'INDEX_BD_ROUTERSUBENTRY') CREATE INDEX INDEX_BD_ROUTERSUBENTRY ON T_BD_ROUTERSUBENTRY ( FENTRYID ,FRESOURCEID );


 EXEC P_ALTERPK 'PK_T_BD_BOMENTRY', 'T_BD_BOMENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'INDEX_BD_BOMENTRY') CREATE INDEX INDEX_BD_BOMENTRY ON T_BD_BOMENTRY ( FMATERIALID ,FVERSIONID ,FAUXPROPERTYID );


 EXEC P_ALTERPK 'PK_T_BD_COSTBOM', 'T_BD_COSTBOM', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'INDEXD_BD_COSTBOM') CREATE INDEX INDEXD_BD_COSTBOM ON T_BD_COSTBOM ( FMATERIALID ,FORGID );


 EXEC P_ALTERPK 'PK_T_BD_COSTBOM_L', 'T_BD_COSTBOM_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_BD_VICEBOMENTRY', 'T_BD_VICEBOMENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'INDEX_BD_VICEBOMENTRY') CREATE INDEX INDEX_BD_VICEBOMENTRY ON T_BD_VICEBOMENTRY ( FID ,FMATERIALID );



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