/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\MDS_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_MDS_DMTP', 'T_MDS_DMTP', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MDS_DMTP_FNUMBER') CREATE INDEX IDX_MDS_DMTP_FNUMBER ON T_MDS_DMTP ( FNUMBER ,FCREATEORGID );


 EXEC P_ALTERPK 'PK_T_MDS_DMTP_L', 'T_MDS_DMTP_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MDS_VRDS', 'T_MDS_VRDS', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MDS_VRDS_FNUMBER') CREATE INDEX IDX_MDS_VRDS_FNUMBER ON T_MDS_VRDS ( FNUMBER ,FCREATEORGID );


 EXEC P_ALTERPK 'PK_T_MDS_VRDS_L', 'T_MDS_VRDS_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MDS_VRDSGRP', 'T_MDS_VRDSGRP', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MDS_VRDSGRP') CREATE INDEX IDX_MDS_VRDSGRP ON T_MDS_VRDSGRP ( FNUMBER ,FCREATEORGID );


 EXEC P_ALTERPK 'PK_T_MDS_VRDSGRP_L', 'T_MDS_VRDSGRP_L', 'FPKID', '1';

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



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