/**Begin D:\PDM_UPGRADE\PDM1\HDM_constraint.sql **/
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HDM_PARTTIMEAPPLYBILL' AND KSQL_INDNAME = 'IDX_HDM_PARTTIME_FMID') CREATE INDEX IDX_HDM_PARTTIME_FMID ON T_HDM_PARTTIMEAPPLYBILL ( FMID );

 EXEC P_ALTERPK 'PK_HDM_PARTTIMEBATCH', 'T_HDM_PARTTIMEBATCH', 'FMID', '1';

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


 EXEC P_ALTERPK 'PK_HDM_PARTTIMEBATCH_L', 'T_HDM_PARTTIMEBATCH_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HDM_PARTTIMEBATCH_L' AND KSQL_INDNAME = 'IDX_HDM_PARTTIMEBATCH_L') CREATE INDEX IDX_HDM_PARTTIMEBATCH_L ON T_HDM_PARTTIMEBATCH_L ( FMID ,FLOCALEID );


 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HDM_REGBASEBILL' AND KSQL_INDNAME = 'IDX_HDM_REGBASEBILL_FMID') CREATE INDEX IDX_HDM_REGBASEBILL_FMID ON T_HDM_REGBASEBILL ( FMID );

 EXEC P_ALTERPK 'PK_HDM_REGBATCH', 'T_HDM_REGBATCH', 'FMID', '1';

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


 EXEC P_ALTERPK 'PK_HDM_REGBATCH_L', 'T_HDM_REGBATCH_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HDM_REGBATCH_L' AND KSQL_INDNAME = 'IDX_HDM_REGBATCH_L') CREATE INDEX IDX_HDM_REGBATCH_L ON T_HDM_REGBATCH_L ( FMID ,FLOCALEID );



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