/**Begin D:\work\kuaijishijian\pdm\PDM_UPGRADE_1.4\PDM_UPGRADE\PDM1\AI_constraint.sql **/
 EXEC P_ALTERPK 'PK_FAH_DIMGRP_INFO', 'T_FAH_DIMGRP_INFO', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_DIMGRP_INFO' AND KSQL_INDNAME = 'IDX_FAH_DIMGRP_INFO_1') CREATE UNIQUE INDEX IDX_FAH_DIMGRP_INFO_1 ON T_FAH_DIMGRP_INFO ( FDATABLOCKID ,FDATABLOCKOFFSET );


 EXEC P_ALTERPK 'PK_FAH_DIMGRP_VALUES', 'T_FAH_DIMGRP_VALUES', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_DIMGRP_VALUES' AND KSQL_INDNAME = 'IDX_FAH_DIMGRP_VALUES') CREATE INDEX IDX_FAH_DIMGRP_VALUES ON T_FAH_DIMGRP_VALUES ( FDIMGRPTYPEID ,FDATABLOCKID );


 EXEC P_ALTERPK 'PK_FAH_DIMGRP_VALUES_TMP', 'T_FAH_DIMGRP_VALUES_TMP', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_DIMGRP_VALUES_TMP' AND KSQL_INDNAME = 'IDX_FAH_DIMGRP_VALUES_TMP') CREATE INDEX IDX_FAH_DIMGRP_VALUES_TMP ON T_FAH_DIMGRP_VALUES_TMP ( FDIMGRPTYPEID );


 EXEC P_ALTERPK 'PK_FAH_REG_DIMVAL_AMT', 'T_FAH_REG_DIMVAL_AMT', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_REG_DIMVAL_AMT' AND KSQL_INDNAME = 'IDX_FAH_REG_DIMVAL_AMT') CREATE INDEX IDX_FAH_REG_DIMVAL_AMT ON T_FAH_REG_DIMVAL_AMT ( FBIZDIMTYPEID ,FDIMVALUE );


 EXEC P_ALTERPK 'PK_FAH_REG_DIMVAL_DT', 'T_FAH_REG_DIMVAL_DT', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_REG_DIMVAL_DT' AND KSQL_INDNAME = 'IDX_FAH_REG_DIMVAL_DT') CREATE INDEX IDX_FAH_REG_DIMVAL_DT ON T_FAH_REG_DIMVAL_DT ( FBIZDIMTYPEID ,FDIMVALUE );


 EXEC P_ALTERPK 'PK_FAH_REG_DIMVAL_TXT', 'T_FAH_REG_DIMVAL_TXT', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_REG_DIMVAL_TXT' AND KSQL_INDNAME = 'IDX_FAH_REG_DIMVAL_TXT') CREATE INDEX IDX_FAH_REG_DIMVAL_TXT ON T_FAH_REG_DIMVAL_TXT ( FBIZDIMTYPEID ,FDIMVALUE );


 EXEC P_ALTERPK 'PK_FAH_BLOCKIDX_AMT', 'T_FAH_BLOCKIDX_AMT', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_BLOCKIDX_AMT' AND KSQL_INDNAME = 'IDX_FAH_BLOCKIDX_AMT_1') CREATE INDEX IDX_FAH_BLOCKIDX_AMT_1 ON T_FAH_BLOCKIDX_AMT ( FDIMVALUE ,FDIMTYPE ,FDATABLOCKID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_BLOCKIDX_AMT' AND KSQL_INDNAME = 'IDX_FAH_BLOCKIDX_AMT_2') CREATE INDEX IDX_FAH_BLOCKIDX_AMT_2 ON T_FAH_BLOCKIDX_AMT ( FDATABLOCKID );


 EXEC P_ALTERPK 'PK_FAH_BLOCKIDX_AMT_MAP', 'T_FAH_BLOCKIDX_AMT_MAP', 'FIDXGRPID,FDIMGRPID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_BLOCKIDX_AMT_MAP' AND KSQL_INDNAME = 'IDX_FAH_BLOCKIDX_AMT_MAP') CREATE INDEX IDX_FAH_BLOCKIDX_AMT_MAP ON T_FAH_BLOCKIDX_AMT_MAP ( FDIMGRPID );


 EXEC P_ALTERPK 'PK_FAH_BLOCKIDX_DT', 'T_FAH_BLOCKIDX_DT', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_BLOCKIDX_DT' AND KSQL_INDNAME = 'IDX_FAH_BLOCKIDX_DT_1') CREATE INDEX IDX_FAH_BLOCKIDX_DT_1 ON T_FAH_BLOCKIDX_DT ( FDIMVALUE ,FDIMTYPE ,FDATABLOCKID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_BLOCKIDX_DT' AND KSQL_INDNAME = 'IDX_FAH_BLOCKIDX_DT_2') CREATE INDEX IDX_FAH_BLOCKIDX_DT_2 ON T_FAH_BLOCKIDX_DT ( FDATABLOCKID );


 EXEC P_ALTERPK 'PK_FAH_BLOCKIDX_DT_MAP', 'T_FAH_BLOCKIDX_DT_MAP', 'FIDXGRPID,FDIMGRPID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_BLOCKIDX_DT_MAP' AND KSQL_INDNAME = 'IDX_FAH_BLOCKIDX_DT_MAP') CREATE INDEX IDX_FAH_BLOCKIDX_DT_MAP ON T_FAH_BLOCKIDX_DT_MAP ( FDIMGRPID );


 EXEC P_ALTERPK 'PK_FAH_BLOCKIDX_ID', 'T_FAH_BLOCKIDX_ID', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_BLOCKIDX_ID' AND KSQL_INDNAME = 'IDX_FAH_BLOCKIDX_ID_1') CREATE INDEX IDX_FAH_BLOCKIDX_ID_1 ON T_FAH_BLOCKIDX_ID ( FDIMVALUE ,FDIMTYPE ,FDATABLOCKID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_BLOCKIDX_ID' AND KSQL_INDNAME = 'IDX_FAH_BLOCKIDX_ID_2') CREATE INDEX IDX_FAH_BLOCKIDX_ID_2 ON T_FAH_BLOCKIDX_ID ( FDATABLOCKID );


 EXEC P_ALTERPK 'PK_FAH_BLOCKIDX_ID_MAP', 'T_FAH_BLOCKIDX_ID_MAP', 'FIDXGRPID,FDIMGRPID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_BLOCKIDX_ID_MAP' AND KSQL_INDNAME = 'IDX_FAH_BLOCKIDX_ID_MAP') CREATE INDEX IDX_FAH_BLOCKIDX_ID_MAP ON T_FAH_BLOCKIDX_ID_MAP ( FDIMGRPID );


 EXEC P_ALTERPK 'PK_FAH_BLOCKIDX_TXT', 'T_FAH_BLOCKIDX_TXT', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_BLOCKIDX_TXT' AND KSQL_INDNAME = 'IDX_FAH_BLOCKIDX_TXT_1') CREATE INDEX IDX_FAH_BLOCKIDX_TXT_1 ON T_FAH_BLOCKIDX_TXT ( FDIMVALUE ,FDIMTYPE ,FDATABLOCKID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_BLOCKIDX_TXT' AND KSQL_INDNAME = 'IDX_FAH_BLOCKIDX_TXT_2') CREATE INDEX IDX_FAH_BLOCKIDX_TXT_2 ON T_FAH_BLOCKIDX_TXT ( FDATABLOCKID );


 EXEC P_ALTERPK 'PK_FAH_BLOCKIDX_TXT_MAP', 'T_FAH_BLOCKIDX_TXT_MAP', 'FIDXGRPID,FDIMGRPID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_BLOCKIDX_TXT_MAP' AND KSQL_INDNAME = 'IDX_FAH_BLOCKIDX_TXT_MAP') CREATE INDEX IDX_FAH_BLOCKIDX_TXT_MAP ON T_FAH_BLOCKIDX_TXT_MAP ( FDIMGRPID );


 EXEC P_ALTERPK 'PK_FAH_DIM_INDEX_INFO', 'T_FAH_DIM_INDEX_INFO', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_DIM_INDEX_INFO' AND KSQL_INDNAME = 'IDX_FAH_DIM_INDEX_INFO') CREATE INDEX IDX_FAH_DIM_INDEX_INFO ON T_FAH_DIM_INDEX_INFO ( FMAXDATABLOCK );



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