/**Begin C:\PDM_UPGRADE\PDM1\PUR_constraint.sql **/
EXEC p_DropIdx 'IDX_PUR_CLAIM_FBILLDATE_ORG', 'T_PUR_CLAIM';
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_CLAIM_FBILLDATE') CREATE INDEX IDX_PUR_CLAIM_FBILLDATE ON T_PUR_CLAIM ( FBILLDATE );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_CLAIM_FORGID') CREATE INDEX IDX_PUR_CLAIM_FORGID ON T_PUR_CLAIM ( FPURORGID );

EXEC p_DropIdx 'IDX_PUR_PROBNOTICE_FBDATE_ORG', 'T_PUR_PROB_NOTICE';
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_PROBNOTICE_FBDATE') CREATE INDEX IDX_PUR_PROBNOTICE_FBDATE ON T_PUR_PROB_NOTICE ( FBILLDATE );

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

 EXEC P_ALTERPK 'PK_PUR_RECTIFY', 'T_PUR_RECTIFY', 'FID', '1';

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

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_RECTIFY_FBILLDATE') CREATE INDEX IDX_PUR_RECTIFY_FBILLDATE ON T_PUR_RECTIFY ( FBILLDATE );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_RECTIFY_FBIZID') CREATE INDEX IDX_PUR_RECTIFY_FBIZID ON T_PUR_RECTIFY ( FBIZPARTNERID );


 EXEC P_ALTERPK 'PK_PUR_RECTIFYENTRY', 'T_PUR_RECTIFYENTRY', 'FENTRYID', '1';

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

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


 EXEC P_ALTERPK 'PK_PUR_RECDESCATTA', 'T_PUR_RECDESCATTA', 'FPKID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_RECDESCATTR_FBASEID') CREATE INDEX IDX_PUR_RECDESCATTR_FBASEID ON T_PUR_RECDESCATTA ( FBASEDATAID );


 EXEC P_ALTERPK 'PK_PUR_RECEVATTA', 'T_PUR_RECEVATTA', 'FPKID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_RECEVATTA_FBASEID') CREATE INDEX IDX_PUR_RECEVATTA_FBASEID ON T_PUR_RECEVATTA ( FBASEDATAID );


 EXEC P_ALTERPK 'PK_PUR_RECCAATTA', 'T_PUR_RECCAATTA', 'FPKID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_RECCAATTA_FBASEID') CREATE INDEX IDX_PUR_RECCAATTA_FBASEID ON T_PUR_RECCAATTA ( FBASEDATAID );


 EXEC P_ALTERPK 'PK_PUR_RECFMATTA', 'T_PUR_RECFMATTA', 'FPKID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_RECFMATTA_FBASEID') CREATE INDEX IDX_PUR_RECFMATTA_FBASEID ON T_PUR_RECFMATTA ( FBASEDATAID );


 EXEC P_ALTERPK 'PK_PUR_RECPMATTA', 'T_PUR_RECPMATTA', 'FPKID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_RECPMATTA_FBASEID') CREATE INDEX IDX_PUR_RECPMATTA_FBASEID ON T_PUR_RECPMATTA ( FBASEDATAID );


 EXEC P_ALTERPK 'PK_PUR_RECTMATTA', 'T_PUR_RECTMATTA', 'FPKID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_RECTMATTA_FBASEID') CREATE INDEX IDX_PUR_RECTMATTA_FBASEID ON T_PUR_RECTMATTA ( FBASEDATAID );


 EXEC P_ALTERPK 'PK_PUR_RECCAUSEENTRY', 'T_PUR_RECCAUSEENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_PUR_RECDESCENTRY', 'T_PUR_RECDESCENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_PUR_RECEVENTRY', 'T_PUR_RECEVENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_PUR_RECFMENTRY', 'T_PUR_RECFMENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_PUR_RECPMENTRY', 'T_PUR_RECPMENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_PUR_RECTEAMENTRY', 'T_PUR_RECTEAMENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_PUR_RECTMENTRY', 'T_PUR_RECTMENTRY', 'FENTRYID', '1';

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



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