/**Begin C:\PDM_UPGRADE\PDM1\PUR_constraint.sql **/
 EXEC P_ALTERPK 'PK_PUR_ORDERENTRY_O', 'T_PUR_ORDERENTRY_O', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_PUR_XORDER', 'T_PUR_XORDER', 'FID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_XORDER_FBIZPARTNERID') CREATE INDEX IDX_PUR_XORDER_FBIZPARTNERID ON T_PUR_XORDER ( FBILLDATE ,FBIZPARTNERID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_XORDER_FSUPPLIERID') CREATE INDEX IDX_PUR_XORDER_FSUPPLIERID ON T_PUR_XORDER ( FSUPPLIERID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_XORDER_FORGID') CREATE INDEX IDX_PUR_XORDER_FORGID ON T_PUR_XORDER ( FORGID );


 EXEC P_ALTERPK 'PK_PUR_XORDER_A', 'T_PUR_XORDER_A', 'FID', '1';

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

 EXEC P_ALTERPK 'PK_PUR_XORDER_L', 'T_PUR_XORDER_L', 'FPKID', '1';

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

 EXEC P_ALTERPK 'PK_PUR_XORDERENTRY', 'T_PUR_XORDERENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_XORDERENTRY_FID_FSEQ') CREATE INDEX IDX_PUR_XORDERENTRY_FID_FSEQ ON T_PUR_XORDERENTRY ( FID ,FSEQ );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_XORDERENTRY_FMATLID') CREATE INDEX IDX_PUR_XORDERENTRY_FMATLID ON T_PUR_XORDERENTRY ( FMATERIALID );


 EXEC P_ALTERPK 'PK_PUR_XORDERENTRY_A', 'T_PUR_XORDERENTRY_A', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_PUR_XORDERENTRY_O', 'T_PUR_XORDERENTRY_O', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_PUR_SALOUTSTOCKENTRY_O', 'T_PUR_SALOUTSTOCKENTRY_O', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_PUR_INSTOCKENTRY_O', 'T_PUR_INSTOCKENTRY_O', 'FENTRYID', '1';

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



/**End C:\PDM_UPGRADE\PDM1\PUR_constraint.sql **/
