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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HAOS_OTCUSTOMTEAM') CREATE INDEX IDX_HAOS_OTCUSTOMTEAM ON T_HAOS_CUSTOMOTSTRUCT ( FORGTEAMID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HAOS_OTCUSTOMPARENT') CREATE INDEX IDX_HAOS_OTCUSTOMPARENT ON T_HAOS_CUSTOMOTSTRUCT ( FPARENTID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HAOS_OTCUSTOMLONGNUMBER') CREATE INDEX IDX_HAOS_OTCUSTOMLONGNUMBER ON T_HAOS_CUSTOMOTSTRUCT ( FSTRUCTLONGNUMBER );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HAOS_OTCUSTOMTEAM_BO') CREATE INDEX IDX_HAOS_OTCUSTOMTEAM_BO ON T_HAOS_CUSTOMOTSTRUCT ( FBOID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HAOS_OTCUSTOMTEAM_BSD') CREATE INDEX IDX_HAOS_OTCUSTOMTEAM_BSD ON T_HAOS_CUSTOMOTSTRUCT ( FBSED ,FBSLED );


 EXEC P_ALTERPK 'PK_HAOS_CUSTOMOTSORT', 'T_HAOS_CUSTOMOTSORT', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HAOS_CUSTOMOTSORT') CREATE INDEX IDX_HAOS_CUSTOMOTSORT ON T_HAOS_CUSTOMOTSORT ( FORGTEAMID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HAOS_CUSTOMOTSORT_BSD') CREATE INDEX IDX_HAOS_CUSTOMOTSORT_BSD ON T_HAOS_CUSTOMOTSORT ( FBSED ,FBSLED );


 EXEC P_ALTERPK 'PK_HAOS_STRUCTTYPE', 'T_HAOS_STRUCTTYPE', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_HAOS_STRUCTTYPE_L', 'T_HAOS_STRUCTTYPE_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HAOS_STRUCTPROENTRY', 'T_HAOS_STRUCTPROENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_HAOS_CUSTOMOROLE', 'T_HAOS_CUSTOMOROLE', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_HAOS_CUSTOMOROLE_L', 'T_HAOS_CUSTOMOROLE_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HAOS_CUSEMPPOSORGREL', 'T_HAOS_CUSEMPPOSORGREL', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HAOS_CUSEMPPOSORGREL_PER') CREATE INDEX IDX_HAOS_CUSEMPPOSORGREL_PER ON T_HAOS_CUSEMPPOSORGREL ( FPERSONID );


 EXEC P_ALTERPK 'PK_HAOS_OUTPERSON', 'T_HAOS_OUTPERSON', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_HAOS_OUTPERSON_L', 'T_HAOS_OUTPERSON_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HAOS_CUSEMPPOSORGREL_L', 'T_HAOS_CUSEMPPOSORGREL_L', 'FPKID', '1';

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



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