/**Begin D:\PDM_UPGRADE\PDM1\HAOS_constraint.sql **/
 EXEC P_ALTERPK 'PK_HAOS_STAFFPROJECT', 'T_HAOS_STAFFPROJECT', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_HAOS_STAFFPROJECT_L', 'T_HAOS_STAFFPROJECT_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HAOS_STAFFDIMENSION', 'T_HAOS_STAFFDIMENSION', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_HAOS_STAFFDIMENSION_L', 'T_HAOS_STAFFDIMENSION_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HAOS_STAFF', 'T_HAOS_STAFF', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_HAOS_STAFF_L', 'T_HAOS_STAFF_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HAOS_DUTYORGDETAIL', 'T_HAOS_DUTYORGDETAIL', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_HAOS_DOSDIMENSION', 'T_HAOS_DOSDIMENSION', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HAOS_DOSDIMENSION') CREATE INDEX IDX_HAOS_DOSDIMENSION ON T_HAOS_DOSDIMENSION ( FENTRYID );


 EXEC P_ALTERPK 'PK_HAOS_USEORGDETAIL', 'T_HAOS_USEORGDETAIL', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_HAOS_UOSDIMENSION', 'T_HAOS_UOSDIMENSION', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HAOS_UOSDIMENSION') CREATE INDEX IDX_HAOS_UOSDIMENSION ON T_HAOS_UOSDIMENSION ( FENTRYID );


 EXEC P_ALTERPK 'PK_HAOS_MULDIMENDETAIL', 'T_HAOS_MULDIMENDETAIL', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_HAOS_STAFFCYCLE', 'T_HAOS_STAFFCYCLE', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_HAOS_STAFFCYCLE_L', 'T_HAOS_STAFFCYCLE_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HAOS_DUTYORGDETAILHIS', 'T_HAOS_DUTYORGDETAILHIS', 'FVID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HAOS_DODETAILHIS_FENTRYID') CREATE INDEX IDX_HAOS_DODETAILHIS_FENTRYID ON T_HAOS_DUTYORGDETAILHIS ( FENTRYID );


 EXEC P_ALTERPK 'PK_HAOS_DOSDIMENSIONHIS', 'T_HAOS_DOSDIMENSIONHIS', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HAOS_DOSDIMENSIONHIS') CREATE INDEX IDX_HAOS_DOSDIMENSIONHIS ON T_HAOS_DOSDIMENSIONHIS ( FVID );


 EXEC P_ALTERPK 'PK_HAOS_USEORGDETAILHIS', 'T_HAOS_USEORGDETAILHIS', 'FVID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HAOS_UODETAILHIS_FID') CREATE INDEX IDX_HAOS_UODETAILHIS_FID ON T_HAOS_USEORGDETAILHIS ( FENTRYID );


 EXEC P_ALTERPK 'PK_HAOS_UOSDIMENSIONHIS', 'T_HAOS_UOSDIMENSIONHIS', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HAOS_UOSDIMENSIONHIS') CREATE INDEX IDX_HAOS_UOSDIMENSIONHIS ON T_HAOS_UOSDIMENSIONHIS ( FVID );

 EXEC P_ALTERPK 'PK_HAOS_MULDIMENDETAILHIS', 'T_HAOS_MULDIMENDETAILHIS', 'FVID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HAOS_MDTHIS_FENTRYID') CREATE INDEX IDX_HAOS_MDTHIS_FENTRYID ON T_HAOS_MULDIMENDETAILHIS ( FENTRYID );


 EXEC p_AlterPK 'PK_HAOS_SPORGENTRY', 'T_HAOS_SPORGENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_HAOS_SPDIMENSION', 'T_HAOS_SPDIMENSION', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HAOS_STAFFMULDIMENSION', 'T_HAOS_STAFFMULDIMENSION', 'FPKID', '1';

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



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