/**Begin D:\PDM_UPGRADE\PDM1\HDM_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_HDM_REG_BEFORECHG_P', 'T_HDM_REG_BEFORECHG_P', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_REGBEFORE_PERSONID') CREATE INDEX IDX_HDM_REGBEFORE_PERSONID ON T_HDM_REG_BEFORECHG_P ( FPERSONID );


 EXEC P_ALTERPK 'PK_T_HDM_REG_AFTERCHG_P', 'T_HDM_REG_AFTERCHG_P', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_REGAFTER_PERSONID') CREATE INDEX IDX_HDM_REGAFTER_PERSONID ON T_HDM_REG_AFTERCHG_P ( FPERSONID );


 EXEC P_ALTERPK 'PK_T_HDM_REG_BEFORECHG_E', 'T_HDM_REG_BEFORECHG_E', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_REGBEFORE_EMPLOYEEID') CREATE INDEX IDX_HDM_REGBEFORE_EMPLOYEEID ON T_HDM_REG_BEFORECHG_E ( FEMPLOYEEID );


 EXEC P_ALTERPK 'PK_T_HDM_REG_AFTERCHG_E', 'T_HDM_REG_AFTERCHG_E', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_REGAFTER_EMPLOYEEID') CREATE INDEX IDX_HDM_REGAFTER_EMPLOYEEID ON T_HDM_REG_AFTERCHG_E ( FEMPLOYEEID );


 EXEC P_ALTERPK 'PK_T_HDM_REG_AFTERCHG_D', 'T_HDM_REG_AFTERCHG_D', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_REGAFTER_FDEPEMPID') CREATE INDEX IDX_HDM_REGAFTER_FDEPEMPID ON T_HDM_REG_AFTERCHG_D ( FDEPEMPID );


 EXEC P_ALTERPK 'PK_T_HDM_REG_BEFORECHG_D', 'T_HDM_REG_BEFORECHG_D', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_REGBEFORE_FDEPEMPID') CREATE INDEX IDX_HDM_REGBEFORE_FDEPEMPID ON T_HDM_REG_BEFORECHG_D ( FDEPEMPID );


 EXEC P_ALTERPK 'PK_T_HDM_BEFORETRANSFER_P', 'T_HDM_BEFORETRANSFER_P', 'FENTRYID', '1';



 EXEC P_ALTERPK 'PK_T_HDM_AFTERTRANSFER_P', 'T_HDM_AFTERTRANSFER_P', 'FENTRYID', '1';



 EXEC P_ALTERPK 'PK_T_HDM_AFTERTRANSFER_E', 'T_HDM_AFTERTRANSFER_E', 'FENTRYID', '1';



 EXEC P_ALTERPK 'PK_T_HDM_BEFORETRANSFER_E', 'T_HDM_BEFORETRANSFER_E', 'FENTRYID', '1';



 EXEC P_ALTERPK 'PK_T_HDM_AFTERTRANSFER_D', 'T_HDM_AFTERTRANSFER_D', 'FENTRYID', '1';



 EXEC P_ALTERPK 'PK_T_HDM_BEFORETRANSFER_D', 'T_HDM_BEFORETRANSFER_D', 'FENTRYID', '1';



 EXEC P_ALTERPK 'PK_T_HDM_PART_BEFORECHG_P', 'T_HDM_PART_BEFORECHG_P', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_PARTBEFORE_PERSONID') CREATE INDEX IDX_HDM_PARTBEFORE_PERSONID ON T_HDM_PART_BEFORECHG_P ( FPERSONID );


 EXEC P_ALTERPK 'PK_T_HDM_PART_AFTERCHG_P', 'T_HDM_PART_AFTERCHG_P', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_PARTAFTER_PERSONID') CREATE INDEX IDX_HDM_PARTAFTER_PERSONID ON T_HDM_PART_AFTERCHG_P ( FPERSONID );


 EXEC P_ALTERPK 'PK_T_HDM_PART_BEFORECHG_E', 'T_HDM_PART_BEFORECHG_E', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_PARTBEFORE_EMPLOYEEID') CREATE INDEX IDX_HDM_PARTBEFORE_EMPLOYEEID ON T_HDM_PART_BEFORECHG_E ( FEMPLOYEEID );


 EXEC P_ALTERPK 'PK_T_HDM_PART_AFTERCHG_E', 'T_HDM_PART_AFTERCHG_E', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_PARTAFTER_EMPLOYEEID') CREATE INDEX IDX_HDM_PARTAFTER_EMPLOYEEID ON T_HDM_PART_AFTERCHG_E ( FEMPLOYEEID );


 EXEC P_ALTERPK 'PK_T_HDM_PART_AFTERCHG_D', 'T_HDM_PART_AFTERCHG_D', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_PARTAFTER_FDEPEMPID') CREATE INDEX IDX_HDM_PARTAFTER_FDEPEMPID ON T_HDM_PART_AFTERCHG_D ( FDEPEMPID );


 EXEC P_ALTERPK 'PK_T_HDM_PART_BEFORECHG_D', 'T_HDM_PART_BEFORECHG_D', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_PARTBEFORE_FDEPEMPID') CREATE INDEX IDX_HDM_PARTBEFORE_FDEPEMPID ON T_HDM_PART_BEFORECHG_D ( FDEPEMPID );


 EXEC P_ALTERPK 'PK_T_HDM_PARTEND_BEFORECHG_P', 'T_HDM_PARTEND_BEFORECHG_P', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_ENDBEFORE_PERSONID') CREATE INDEX IDX_HDM_ENDBEFORE_PERSONID ON T_HDM_PARTEND_BEFORECHG_P ( FPERSONID );


 EXEC P_ALTERPK 'PK_T_HDM_PARTEND_AFTERCHG_P', 'T_HDM_PARTEND_AFTERCHG_P', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_ENDAFTER_PERSONID') CREATE INDEX IDX_HDM_ENDAFTER_PERSONID ON T_HDM_PARTEND_AFTERCHG_P ( FPERSONID );


 EXEC P_ALTERPK 'PK_T_HDM_PARTEND_BEFORECHG_E', 'T_HDM_PARTEND_BEFORECHG_E', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_ENDBEFORE_EMPLOYEEID') CREATE INDEX IDX_HDM_ENDBEFORE_EMPLOYEEID ON T_HDM_PARTEND_BEFORECHG_E ( FEMPLOYEEID );


 EXEC P_ALTERPK 'PK_T_HDM_PARTEND_AFTERCHG_E', 'T_HDM_PARTEND_AFTERCHG_E', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_ENDAFTER_EMPLOYEEID') CREATE INDEX IDX_HDM_ENDAFTER_EMPLOYEEID ON T_HDM_PARTEND_AFTERCHG_E ( FEMPLOYEEID );


 EXEC P_ALTERPK 'PK_T_HDM_PARTEND_AFTERCHG_D', 'T_HDM_PARTEND_AFTERCHG_D', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_ENDAFTER_FDEPEMPID') CREATE INDEX IDX_HDM_ENDAFTER_FDEPEMPID ON T_HDM_PARTEND_AFTERCHG_D ( FDEPEMPID );


 EXEC P_ALTERPK 'PK_T_HDM_PARTEND_BEFORECHG_D', 'T_HDM_PARTEND_BEFORECHG_D', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_ENDBEFORE_FDEPEMPID') CREATE INDEX IDX_HDM_ENDBEFORE_FDEPEMPID ON T_HDM_PARTEND_BEFORECHG_D ( FDEPEMPID );



/**End D:\PDM_UPGRADE\PDM1\HDM_constraint.sql **/
