/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\HDM_constraint.sql **/
 EXEC P_ALTERPK 'PK_HDM_ENDPARTEVENT', 'T_HDM_ENDPARTEVENT', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_ENDPARTEVENT') CREATE INDEX IDX_HDM_ENDPARTEVENT ON T_HDM_ENDPARTEVENT ( FSOURCEBILLID );


 EXEC P_ALTERPK 'PK_HDM_ENDPARTEVENT_L', 'T_HDM_ENDPARTEVENT_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_ENDPARTEVENT_L') CREATE INDEX IDX_HDM_ENDPARTEVENT_L ON T_HDM_ENDPARTEVENT_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_HDM_PARTBILLEVENT', 'T_HDM_PARTBILLEVENT', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_PARTBILLEVENT') CREATE INDEX IDX_HDM_PARTBILLEVENT ON T_HDM_PARTBILLEVENT ( FSOURCEBILLID );


 EXEC P_ALTERPK 'PK_HDM_PARTBILLEVENT_L', 'T_HDM_PARTBILLEVENT_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_PARTBILLEVENT_L') CREATE INDEX IDX_HDM_PARTBILLEVENT_L ON T_HDM_PARTBILLEVENT_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_HDM_PARTTIMEAPPLYBILL', 'T_HDM_PARTTIMEAPPLYBILL', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_PARTTIMEAPPLYBILL') CREATE INDEX IDX_HDM_PARTTIMEAPPLYBILL ON T_HDM_PARTTIMEAPPLYBILL ( FBILLNO );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_PARTTIMEAPPLYBILL_AD') CREATE INDEX IDX_HDM_PARTTIMEAPPLYBILL_AD ON T_HDM_PARTTIMEAPPLYBILL ( FPRIMARYAFTADMINORGID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_PARTTIMEAPPLYBILL_ORG') CREATE INDEX IDX_HDM_PARTTIMEAPPLYBILL_ORG ON T_HDM_PARTTIMEAPPLYBILL ( FORGID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_PARTTIMEAPPLYBILL_EG') CREATE INDEX IDX_HDM_PARTTIMEAPPLYBILL_EG ON T_HDM_PARTTIMEAPPLYBILL ( FPRIMARYEMPGROUPID );


 EXEC P_ALTERPK 'PK_HDM_PARTTIMEAPPLYBILL_A', 'T_HDM_PARTTIMEAPPLYBILL_A', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_PARTTIMEAPPLYBILL_A') CREATE INDEX IDX_HDM_PARTTIMEAPPLYBILL_A ON T_HDM_PARTTIMEAPPLYBILL_A ( FISSUBMIT );


 EXEC P_ALTERPK 'PK_HDM_PARTTIMEENDBILL', 'T_HDM_PARTTIMEENDBILL', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_PARTTIMEENDBILL') CREATE INDEX IDX_HDM_PARTTIMEENDBILL ON T_HDM_PARTTIMEENDBILL ( FBILLNO );


 EXEC P_ALTERPK 'PK_HDM_PARTTIMEKEYINFO', 'T_HDM_PARTTIMEKEYINFO', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_HDM_PARTTIMEKEYINFO_L', 'T_HDM_PARTTIMEKEYINFO_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_PARTTIMEKEYINFO_L') CREATE INDEX IDX_HDM_PARTTIMEKEYINFO_L ON T_HDM_PARTTIMEKEYINFO_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_HDM_PARTTIMEREASON', 'T_HDM_PARTTIMEREASON', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_PARTTIMEREASON') CREATE INDEX IDX_HDM_PARTTIMEREASON ON T_HDM_PARTTIMEREASON ( FNUMBER );


 EXEC P_ALTERPK 'PK_HDM_PARTTIMEREASON_L', 'T_HDM_PARTTIMEREASON_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_PARTTIMEREASON_L') CREATE INDEX IDX_HDM_PARTTIMEREASON_L ON T_HDM_PARTTIMEREASON_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_HDM_PARTTIMEWORKROLE', 'T_HDM_PARTTIMEWORKROLE', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_PARTTIMEWORKROLE') CREATE INDEX IDX_HDM_PARTTIMEWORKROLE ON T_HDM_PARTTIMEWORKROLE ( FID );



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