/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\HPDI_constraint.sql **/

 EXEC P_ALTERPK 'PK_HPDI_PAYROLLACT', 'T_HPDI_PAYROLLACT', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_HPDI_PAYROLLACT_L', 'T_HPDI_PAYROLLACT_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HPDI_PAYROLLACTENT', 'T_HPDI_PAYROLLACTENT', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HPDI_PAYROLLACTENT') CREATE INDEX IDX_HPDI_PAYROLLACTENT ON T_HPDI_PAYROLLACTENT ( FTRIGGERCOLLAID );


 EXEC P_ALTERPK 'PK_HPDI_PAYROLLACTG', 'T_HPDI_PAYROLLACTG', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_HPDI_PAYROLLACTG_L', 'T_HPDI_PAYROLLACTG_L', 'FPKID', '1';

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

 EXEC P_ALTERPK 'PK_HPDI_PAYROLLACTGTPL', 'T_HPDI_PAYROLLACTGTPL', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_HPDI_PAYROLLACTGTPL_L', 'T_HPDI_PAYROLLACTGTPL_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HPDI_PAYROLLACTGTPLENT', 'T_HPDI_PAYROLLACTGTPLENT', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HPDI_PAYROLLACTGTPLENT') CREATE INDEX IDX_HPDI_PAYROLLACTGTPLENT ON T_HPDI_PAYROLLACTGTPLENT ( FPAYROLLACTID );


 EXEC P_ALTERPK 'PK_HPDI_TRIGGERCOLLA', 'T_HPDI_TRIGGERCOLLA', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HPDI_TRIGGERCOLLA') CREATE INDEX IDX_HPDI_TRIGGERCOLLA ON T_HPDI_TRIGGERCOLLA ( FENTITYOBJECTID );


 EXEC P_ALTERPK 'PK_HPDI_TRIGGERCOLLA_L', 'T_HPDI_TRIGGERCOLLA_L', 'FPKID', '1';

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



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