/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\PUR_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_PUR_APISCHEME_L', 'T_PUR_APISCHEME_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_PUR_EXTAPI_L', 'T_PUR_EXTAPI_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_PUR_APISCHEME', 'T_PUR_APISCHEME', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_PUR_EXIAPI', 'T_PUR_EXIAPI', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_PUR_EXTAPIENTRY', 'T_PUR_EXTAPIENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_PUR_APISCHEMEENTRY', 'T_PUR_APISCHEMEENTRY', 'FENTRYID', '1';

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

 EXEC P_ALTERPK 'PK_T_PUR_SETTINGURL_L', 'T_PUR_SETTINGURL_L', 'FPKID', '1';
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_SETTINGURL_L_FID') CREATE INDEX IDX_PUR_SETTINGURL_L_FID ON T_PUR_SETTINGURL_L ( FID ,FLOCALEID );
 
 EXEC P_ALTERPK 'PK_T_PUR_SETTINGURL', 'T_PUR_SETTINGURL', 'FID', '1';
 
  IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_SETTINGURL_FID') CREATE INDEX IDX_PUR_SETTINGURL_FID ON T_PUR_SETTINGURL ( FID ,FNUMBER );
  
EXEC p_DropIdx 'IDX_PUR_REGSUPPLIER_FName', 'T_PUR_REGSUPPLIER_L';
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_REGSUPPLIER_FNAME') CREATE INDEX IDX_PUR_REGSUPPLIER_FNAME ON T_PUR_REGSUPPLIER_L ( FNAME ,FID ,FLOCALEID );

EXEC p_DropIdx 'IDX_PUR_USER_Enterprise', 'T_PUR_USER_L';
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_USER_ENTERPRISE') CREATE INDEX IDX_PUR_USER_ENTERPRISE ON T_PUR_USER_L ( FENTERPRISE ,FID ,FLOCALEID );



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