/**Begin D:\PDM_UPGRADE\PDM1\HDM_constraint.sql **/
 EXEC P_ALTERPK 'PK_HDM_SECONDMENTAPPLY', 'T_HDM_SECONDMENTAPPLY', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HDM_SECONDMENTAPPLY' AND KSQL_INDNAME = 'IDX_HDM_SECONDMENTAPPLY') CREATE INDEX IDX_HDM_SECONDMENTAPPLY ON T_HDM_SECONDMENTAPPLY ( FBILLNO );


 EXEC P_ALTERPK 'PK_HDM_SECONDMENTAPPLY_L', 'T_HDM_SECONDMENTAPPLY_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HDM_SECONDMENTAPPLY_A', 'T_HDM_SECONDMENTAPPLY_A', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HDM_SECONDMENTAPPLY_A' AND KSQL_INDNAME = 'IDX_HDM_SECONDMENTAPPLY_A') CREATE INDEX IDX_HDM_SECONDMENTAPPLY_A ON T_HDM_SECONDMENTAPPLY_A ( FTERMINATETIME );


 EXEC P_ALTERPK 'PK_HDM_SECDINCHARGE', 'T_HDM_SECDINCHARGE', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HDM_SECDOUTSUPERIOR', 'T_HDM_SECDOUTSUPERIOR', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HDM_SECDOUTCHARGE', 'T_HDM_SECDOUTCHARGE', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HDM_SECDINSUPERIOR', 'T_HDM_SECDINSUPERIOR', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HDM_SECDPLANINCHA', 'T_HDM_SECDPLANINCHA', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HDM_SECDPLANINSUP', 'T_HDM_SECDPLANINSUP', 'FPKID', '1';

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



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