/**Begin D:\PDM_UPGRADE\PDM1\HDM_constraint.sql **/
 EXEC P_ALTERPK 'PK_HDM_SECBACKINCHARGE', 'T_HDM_SECBACKINCHARGE', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HDM_SECBACKINCHARGE' AND KSQL_INDNAME = 'IDX_HDM_SECBACKINCHARGE') CREATE INDEX IDX_HDM_SECBACKINCHARGE ON T_HDM_SECBACKINCHARGE ( FID ,FBASEDATAID );


 EXEC P_ALTERPK 'PK_HDM_SECBACKINCHARGEIN', 'T_HDM_SECBACKINCHARGEIN', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HDM_SECBACKINCHARGEIN' AND KSQL_INDNAME = 'IDX_HDM_SECBACKINCHARGEIN') CREATE INDEX IDX_HDM_SECBACKINCHARGEIN ON T_HDM_SECBACKINCHARGEIN ( FID ,FBASEDATAID );


 EXEC P_ALTERPK 'PK_HDM_SECBACKSUPERIOR', 'T_HDM_SECBACKSUPERIOR', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HDM_SECBACKSUPERIOR' AND KSQL_INDNAME = 'IDX_HDM_SECBACKSUPERIOR') CREATE INDEX IDX_HDM_SECBACKSUPERIOR ON T_HDM_SECBACKSUPERIOR ( FID ,FBASEDATAID );


 EXEC P_ALTERPK 'PK_HDM_SECBACKSUPERIORIN', 'T_HDM_SECBACKSUPERIORIN', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HDM_SECBACKSUPERIORIN' AND KSQL_INDNAME = 'IDX_HDM_SECBACKSUPERIORIN') CREATE INDEX IDX_HDM_SECBACKSUPERIORIN ON T_HDM_SECBACKSUPERIORIN ( FID ,FBASEDATAID );


 EXEC P_ALTERPK 'PK_HDM_SECBACK', 'T_HDM_SECBACK', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HDM_SECBACK' AND KSQL_INDNAME = 'IDX_HDM_SECBACK') CREATE INDEX IDX_HDM_SECBACK ON T_HDM_SECBACK ( FSECONDMENTRECORDID ,FPERSONID ,FERMANFILEID );


 EXEC P_ALTERPK 'PK_HDM_SECBACK_A', 'T_HDM_SECBACK_A', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HDM_SECBACK_A' AND KSQL_INDNAME = 'IDX_HDM_SECBACK_A') CREATE INDEX IDX_HDM_SECBACK_A ON T_HDM_SECBACK_A ( FDEPTINID );


 EXEC P_ALTERPK 'PK_HDM_SECBACK_L', 'T_HDM_SECBACK_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HDM_SECRECORDCHG', 'T_HDM_SECRECORDCHG', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HDM_SECRECORDCHG' AND KSQL_INDNAME = 'IDX_HDM_SECRECORDCHG') CREATE INDEX IDX_HDM_SECRECORDCHG ON T_HDM_SECRECORDCHG ( FERMANFILEID ,FSECRECORDID ,FPERSONID );


 EXEC P_ALTERPK 'PK_HDM_SECRECORDCHG_L', 'T_HDM_SECRECORDCHG_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HDM_SECRECORDCHG_A', 'T_HDM_SECRECORDCHG_A', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_HDM_SECRECORDBUSEVENT', 'T_HDM_SECRECORDBUSEVENT', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HDM_SECRECORDBUSEVENT' AND KSQL_INDNAME = 'IDX_HDM_SECEVENT_FBOID') CREATE INDEX IDX_HDM_SECEVENT_FBOID ON T_HDM_SECRECORDBUSEVENT ( FBOID );


 EXEC P_ALTERPK 'PK_HDM_SECRECORDEVENT', 'T_HDM_SECRECORDEVENT', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HDM_SECRECORDEVENT' AND KSQL_INDNAME = 'IDX_HDM_SECRECORDEVENT_EVENTID') CREATE INDEX IDX_HDM_SECRECORDEVENT_EVENTID ON T_HDM_SECRECORDEVENT ( FCANCELEDEVENTID );


 EXEC P_ALTERPK 'PK_HDM_SECRECORDHIS', 'T_HDM_SECRECORDHIS', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HDM_SECRECORDHIS' AND KSQL_INDNAME = 'IDX_HDM_SECRECORDHIS_FVID') CREATE INDEX IDX_HDM_SECRECORDHIS_FVID ON T_HDM_SECRECORDHIS ( FVID );


 EXEC P_ALTERPK 'PK_HDM_SECONDMENTRECORD', 'T_HDM_SECONDMENTRECORD', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HDM_SECONDMENTRECORD' AND KSQL_INDNAME = 'IDX_HDM_SECRECORD_ERMANFILEID') CREATE INDEX IDX_HDM_SECRECORD_ERMANFILEID ON T_HDM_SECONDMENTRECORD ( FERMANFILEID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HDM_SECONDMENTRECORD' AND KSQL_INDNAME = 'IDX_HDM_SECRECORD_DEPEMP') CREATE INDEX IDX_HDM_SECRECORD_DEPEMP ON T_HDM_SECONDMENTRECORD ( FDEPEMPID );


 EXEC P_ALTERPK 'PK_HDM_SECONDMENTRECORD_A', 'T_HDM_SECONDMENTRECORD_A', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HDM_SECONDMENTRECORD_A' AND KSQL_INDNAME = 'IDX_HDM_SECRECORD_FORGBACKID') CREATE INDEX IDX_HDM_SECRECORD_FORGBACKID ON T_HDM_SECONDMENTRECORD_A ( FORGBACKID );


 EXEC P_ALTERPK 'PK_HDM_SECONDMENTRECORD_L', 'T_HDM_SECONDMENTRECORD_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HDM_SECINSUP', 'T_HDM_SECINSUP', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HDM_SECINSUP' AND KSQL_INDNAME = 'IDX_HDM_SECINSUP') CREATE INDEX IDX_HDM_SECINSUP ON T_HDM_SECINSUP ( FID ,FBASEDATAID );


 EXEC P_ALTERPK 'PK_HDM_SECININCHARGE', 'T_HDM_SECININCHARGE', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HDM_SECININCHARGE' AND KSQL_INDNAME = 'IDX_HDM_SECININCHARGE') CREATE INDEX IDX_HDM_SECININCHARGE ON T_HDM_SECININCHARGE ( FID ,FBASEDATAID );


 EXEC P_ALTERPK 'PK_HDM_SECOUTINCHARGE', 'T_HDM_SECOUTINCHARGE', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HDM_SECOUTINCHARGE' AND KSQL_INDNAME = 'IDX_HDM_SECOUTINCHARGE') CREATE INDEX IDX_HDM_SECOUTINCHARGE ON T_HDM_SECOUTINCHARGE ( FID ,FBASEDATAID );


 EXEC P_ALTERPK 'PK_HDM_SECOUTSUP', 'T_HDM_SECOUTSUP', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HDM_SECOUTSUP' AND KSQL_INDNAME = 'IDX_HDM_SECOUTSUP') CREATE INDEX IDX_HDM_SECOUTSUP ON T_HDM_SECOUTSUP ( FID ,FBASEDATAID );



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