/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\SYSEXT_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_KF_INSTANCE', 'T_KF_INSTANCE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_KF_INSTANCE' AND KSQL_INDNAME = 'IDX_KF_INS_NUMBER') CREATE UNIQUE INDEX IDX_KF_INS_NUMBER ON T_KF_INSTANCE ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_KF_INSTANCE_L', 'T_KF_INSTANCE_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_KF_INSTANCE_L' AND KSQL_INDNAME = 'IDX_KF_INS_L_FID') CREATE UNIQUE INDEX IDX_KF_INS_L_FID ON T_KF_INSTANCE_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_T_KF_REFRENCE_L', 'T_KF_REFRENCE_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_KF_REFRENCE_L' AND KSQL_INDNAME = 'IDX_KF_REF_L_FID') CREATE UNIQUE INDEX IDX_KF_REF_L_FID ON T_KF_REFRENCE_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_T_KF_INSTANCEGROUP', 'T_KF_INSTANCEGROUP', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_KF_INSTANCEGROUP' AND KSQL_INDNAME = 'IDX_KF_INS_GROUP_NUMBER') CREATE UNIQUE INDEX IDX_KF_INS_GROUP_NUMBER ON T_KF_INSTANCEGROUP ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_KF_INSTANCEGROUP_L', 'T_KF_INSTANCEGROUP_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_KF_INSTANCEGROUP_L' AND KSQL_INDNAME = 'IDX_KF_INS_GROUP_L_FID') CREATE UNIQUE INDEX IDX_KF_INS_GROUP_L_FID ON T_KF_INSTANCEGROUP_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_T_KF_REFERENCE', 'T_KF_REFERENCE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_KF_REFERENCE' AND KSQL_INDNAME = 'IDX_KF_REF_RESOURCEID') CREATE INDEX IDX_KF_REF_RESOURCEID ON T_KF_REFERENCE ( FRESOURCEID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_KF_REFERENCE' AND KSQL_INDNAME = 'IDX_KF_REF_KFID') CREATE INDEX IDX_KF_REF_KFID ON T_KF_REFERENCE ( FKFID );



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