/**Begin D:\work\kuaijishijian\pdm\PDM_UPGRADE_1.4\PDM_UPGRADE\PDM1\AI_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_FAH_FLEX_STRUC', 'T_FAH_FLEX_STRUC', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_FLEX_STRUC' AND KSQL_INDNAME = 'IDX_FAH_FLEX_STRUC_F') CREATE UNIQUE INDEX IDX_FAH_FLEX_STRUC_F ON T_FAH_FLEX_STRUC ( FID ,FATTNUM );


 EXEC P_ALTERPK 'PK_T_FAH_FLEX_STRUC_TYPE', 'T_FAH_FLEX_STRUC_TYPE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_FLEX_STRUC_TYPE' AND KSQL_INDNAME = 'IDX_FAH_FLEX_STRUC_TYPE_NO') CREATE UNIQUE INDEX IDX_FAH_FLEX_STRUC_TYPE_NO ON T_FAH_FLEX_STRUC_TYPE ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_FAH_VALUESET_TYPE', 'T_FAH_VALUESET_TYPE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_VALUESET_TYPE' AND KSQL_INDNAME = 'IDX_FAH_VALUESET_TYPE_NO') CREATE UNIQUE INDEX IDX_FAH_VALUESET_TYPE_NO ON T_FAH_VALUESET_TYPE ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_FAH_VALMAP_STRUC', 'T_FAH_VALMAP_STRUC', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_VALMAP_STRUC' AND KSQL_INDNAME = 'IDX_FAH_VALMAP_STRUC_NO') CREATE UNIQUE INDEX IDX_FAH_VALMAP_STRUC_NO ON T_FAH_VALMAP_STRUC ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_FAH_VALMAP_TYPE', 'T_FAH_VALMAP_TYPE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_VALMAP_TYPE' AND KSQL_INDNAME = 'IDX_FAH_VALMAP_TYPE_NO') CREATE UNIQUE INDEX IDX_FAH_VALMAP_TYPE_NO ON T_FAH_VALMAP_TYPE ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_FAH_FLEX_VALUESET', 'T_FAH_FLEX_VALUESET', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_FLEX_VALUESET' AND KSQL_INDNAME = 'IDX_FAH_FLEX_VALUESET_NO') CREATE UNIQUE INDEX IDX_FAH_FLEX_VALUESET_NO ON T_FAH_FLEX_VALUESET ( FVALUESETTYPEID ,FNUMBER );


 EXEC P_ALTERPK 'PK_T_FAH_FLEX_MAPVAL', 'T_FAH_FLEX_MAPVAL', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_FLEX_MAPVAL' AND KSQL_INDNAME = 'IDX_FAH_FLEX_MAPVAL_TH') CREATE INDEX IDX_FAH_FLEX_MAPVAL_TH ON T_FAH_FLEX_MAPVAL ( FMAPTYPEID ,FHASHCODE );


 EXEC P_ALTERPK 'PK_T_FAH_VALMAP_TYPE_L', 'T_FAH_VALMAP_TYPE_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_VALMAP_TYPE_L' AND KSQL_INDNAME = 'IDX_FAH_VALMAP_TYPE_L') CREATE INDEX IDX_FAH_VALMAP_TYPE_L ON T_FAH_VALMAP_TYPE_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_T_FAH_FLEX_VAL_TMP', 'T_FAH_FLEX_VAL_TMP', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_FLEX_VAL_TMP' AND KSQL_INDNAME = 'IDX_FAH_FLEX_VAL_TMP') CREATE INDEX IDX_FAH_FLEX_VAL_TMP ON T_FAH_FLEX_VAL_TMP ( FBATCHID );


 EXEC P_ALTERPK 'PK_T_FAH_FLEX_MAPVAL_EN_TMP', 'T_FAH_FLEX_MAPVAL_EN_TMP', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_FLEX_MAPVAL_EN_TMP' AND KSQL_INDNAME = 'IDX_PK_FAH_FLEX_MAPVAL_EN_TMP') CREATE INDEX IDX_PK_FAH_FLEX_MAPVAL_EN_TMP ON T_FAH_FLEX_MAPVAL_EN_TMP ( FBATCHID );


 EXEC P_ALTERPK 'PK_T_FAH_FLEX_IMPORT_LOG', 'T_FAH_FLEX_IMPORT_LOG', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_FLEX_IMPORT_LOG' AND KSQL_INDNAME = 'IDX_FAH_FLEX_IMPORT_LOG_1') CREATE INDEX IDX_FAH_FLEX_IMPORT_LOG_1 ON T_FAH_FLEX_IMPORT_LOG ( FBATCHID );


 EXEC P_ALTERPK 'PK_T_FAH_FLEX_IMPORT_LOG_EN', 'T_FAH_FLEX_IMPORT_LOG_EN', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_FLEX_IMPORT_LOG_EN' AND KSQL_INDNAME = 'IDX_FAH_FLEX_IMPORT_LOG_EN') CREATE INDEX IDX_FAH_FLEX_IMPORT_LOG_EN ON T_FAH_FLEX_IMPORT_LOG_EN ( FID );



/**End D:\work\kuaijishijian\pdm\PDM_UPGRADE_1.4\PDM_UPGRADE\PDM1\AI_constraint.sql **/
