/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\PUR_constraint.sql **/
 EXEC P_ALTERPK 'PK_PUR_EVAPLANSCORER', 'T_PUR_EVAPLANSCORER', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_PUR_SCHEME_CATEGORY', 'T_PUR_SCHEME_CATEGORY', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_SCHEME_CAT_FID') CREATE INDEX IDX_PUR_SCHEME_CAT_FID ON T_PUR_SCHEME_CATEGORY ( FID ,FBASEDATAID );


 EXEC P_ALTERPK 'PK_PUR_SCHEME_ORG', 'T_PUR_SCHEME_ORG', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_SCHEME_ORG_FID') CREATE INDEX IDX_PUR_SCHEME_ORG_FID ON T_PUR_SCHEME_ORG ( FID ,FBASEDATAID );


 EXEC P_ALTERPK 'PK_PUR_SCHEMESCORER', 'T_PUR_SCHEMESCORER', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_PUR_SCOREDETAIL', 'T_PUR_SCOREDETAIL', 'FDETAILID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_SCOREDETAIL_EIDSEQ') CREATE INDEX IDX_PUR_SCOREDETAIL_EIDSEQ ON T_PUR_SCOREDETAIL ( FENTRYID ,FSEQ );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_SCOREDETAIL_SCORER') CREATE INDEX IDX_PUR_SCOREDETAIL_SCORER ON T_PUR_SCOREDETAIL ( FSCORERID );


 EXEC P_ALTERPK 'PK_PUR_EVAPLAN', 'T_PUR_EVAPLAN', 'FID', '1';

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

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


 EXEC P_ALTERPK 'PK_PUR_SCOREENTRY', 'T_PUR_SCOREENTRY', 'FENTRYID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_SCOREENTRY_INDEX') CREATE INDEX IDX_PUR_SCOREENTRY_INDEX ON T_PUR_SCOREENTRY ( FINDEXID );


 EXEC P_ALTERPK 'PK_PUR_EVAPLANDETAIL', 'T_PUR_EVAPLANDETAIL', 'FDETAILID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_EVADETAIL_EIDSEQ') CREATE INDEX IDX_PUR_EVADETAIL_EIDSEQ ON T_PUR_EVAPLANDETAIL ( FENTRYID ,FSEQ );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_EVADETAIL_SCORER') CREATE INDEX IDX_PUR_EVADETAIL_SCORER ON T_PUR_EVAPLANDETAIL ( FSCORERID );


 EXEC P_ALTERPK 'PK_PUR_EVAPLANENTRY', 'T_PUR_EVAPLANENTRY', 'FENTRYID', '1';

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

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


 EXEC P_ALTERPK 'PK_PUR_EVAPLAN_A', 'T_PUR_EVAPLAN_A', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_PUR_EVAPLANINDEX', 'T_PUR_EVAPLANINDEX', 'FENTRYID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_EVAPLANINDEX_INDEX') CREATE INDEX IDX_PUR_EVAPLANINDEX_INDEX ON T_PUR_EVAPLANINDEX ( FINDEXID );


 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_SCORE_TASKNO') CREATE INDEX IDX_PUR_SCORE_TASKNO ON T_PUR_SCORE ( FTASKBILLNO );

 EXEC P_ALTERPK 'PK_PUR_EVAGRADE_L', 'T_PUR_EVAGRADE_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_PUR_EVAPLAN_L', 'T_PUR_EVAPLAN_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_PUR_SCHEME', 'T_PUR_SCHEME', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_SCHEME_FNUMBER') CREATE INDEX IDX_PUR_SCHEME_FNUMBER ON T_PUR_SCHEME ( FNUMBER );


 EXEC P_ALTERPK 'PK_PUR_SCHEME_L', 'T_PUR_SCHEME_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_PUR_SCHEMEENTRY', 'T_PUR_SCHEMEENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_PUR_INDEX_EVATYPE', 'T_PUR_INDEX_EVATYPE', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_INDEX_EVATYPE_FID') CREATE INDEX IDX_PUR_INDEX_EVATYPE_FID ON T_PUR_INDEX_EVATYPE ( FID ,FBASEDATAID );


 EXEC P_ALTERPK 'PK_PUR_EVAGRADE', 'T_PUR_EVAGRADE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_EVAGRADE_FNUMBER') CREATE INDEX IDX_PUR_EVAGRADE_FNUMBER ON T_PUR_EVAGRADE ( FNUMBER );



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