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

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


 EXEC P_ALTERPK 'PK_PUR_APISERVICE', 'T_PUR_APISERVICE', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_PUR_PATTERN', 'T_PUR_PATTERN', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_PUR_PATTERN_L', 'T_PUR_PATTERN_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_PUR_PATTERNENTRY', 'T_PUR_PATTERNENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_PUR_EXTDATA', 'T_PUR_EXTDATA', 'FID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_EXTDATA_FMASTERID') CREATE INDEX IDX_PUR_EXTDATA_FMASTERID ON T_PUR_EXTDATA ( FMASTERID );


 EXEC P_ALTERPK 'PK_PUR_EXTDATA_L', 'T_PUR_EXTDATA_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_PUR_EXTTYPE', 'T_PUR_EXTTYPE', 'FID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PUR_EXTTYPE_FMASTERID') CREATE INDEX IDX_PUR_EXTTYPE_FMASTERID ON T_PUR_EXTTYPE ( FMASTERID );


 EXEC P_ALTERPK 'PK_PUR_EXTTYPE_L', 'T_PUR_EXTTYPE_L', 'FPKID', '1';

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



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