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

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


 EXEC P_ALTERPK 'PK_FAH_EVENT_LINE', 'T_FAH_EVENT_LINE', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_FAH_EVENT_LINE_TMP', 'T_FAH_EVENT_LINE_TMP', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_FAH_EVENT_SEQ', 'T_FAH_EVENT_SEQ', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_EVENT_SEQ' AND KSQL_INDNAME = 'IDX_FAH_EVENT_SEQ') CREATE INDEX IDX_FAH_EVENT_SEQ ON T_FAH_EVENT_SEQ ( FSEQ );


 EXEC P_ALTERPK 'PK_FAH_AE_HEADERS', 'T_FAH_AE_HEADERS', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_AE_HEADERS' AND KSQL_INDNAME = 'IDX_FAH_AE_HEADERS_1') CREATE INDEX IDX_FAH_AE_HEADERS_1 ON T_FAH_AE_HEADERS ( FSRC_BILLID ,FREQUESTID );


 EXEC P_ALTERPK 'PK_FAH_AE_HEADERS_TMP', 'T_FAH_AE_HEADERS_TMP', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_AE_HEADERS_TMP' AND KSQL_INDNAME = 'IDX_FAH_AE_HEADERS_TMP1') CREATE INDEX IDX_FAH_AE_HEADERS_TMP1 ON T_FAH_AE_HEADERS_TMP ( FSRCEVENTID );


 EXEC P_ALTERPK 'PK_FAH_AE_LINES', 'T_FAH_AE_LINES', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_FAH_AE_LINES_TMP', 'T_FAH_AE_LINES_TMP', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_FAH_REQUEST_TASK', 'T_FAH_REQUEST_TASK', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_REQUEST_TASK' AND KSQL_INDNAME = 'IDX_FAH_REQUEST_TASK') CREATE INDEX IDX_FAH_REQUEST_TASK ON T_FAH_REQUEST_TASK ( FTASKNO );


 EXEC P_ALTERPK 'PK_FAH_REQUEST_TASK_BILL', 'T_FAH_REQUEST_TASK_BILL', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_FAH_REQUEST_TASK_ORG', 'T_FAH_REQUEST_TASK_ORG', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_FAH_TASK_BATCH', 'T_FAH_TASK_BATCH', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_TASK_BATCH' AND KSQL_INDNAME = 'IDX_FAH_TASK_BATCH') CREATE INDEX IDX_FAH_TASK_BATCH ON T_FAH_TASK_BATCH ( FREQUESTID ,FBILLTYPE ,FSTATUS );


 EXEC P_ALTERPK 'PK_FAH_TASK_BATCH_EN', 'T_FAH_TASK_BATCH_EN', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_FAH_TASK_FAIL_BILLS', 'T_FAH_TASK_FAIL_BILLS', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_TASK_FAIL_BILLS' AND KSQL_INDNAME = 'IDX_FAH_TASK_FAIL_BILLS') CREATE INDEX IDX_FAH_TASK_FAIL_BILLS ON T_FAH_TASK_FAIL_BILLS ( FREQUESTID );


 EXEC P_ALTERPK 'PK_FAH_LOG_DISPATCH', 'T_FAH_LOG_DISPATCH', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_LOG_DISPATCH' AND KSQL_INDNAME = 'IDX_FAH_LOG_DISPATCH') CREATE INDEX IDX_FAH_LOG_DISPATCH ON T_FAH_LOG_DISPATCH ( FREQUESTID );


 EXEC P_ALTERPK 'PK_FAH_LOG_DISPATCH_EN', 'T_FAH_LOG_DISPATCH_EN', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_FAH_EVT_TRACKER', 'T_FAH_EVT_TRACKER', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_EVT_TRACKER' AND KSQL_INDNAME = 'IDX_FAH_EVT_TRACKER') CREATE INDEX IDX_FAH_EVT_TRACKER ON T_FAH_EVT_TRACKER ( FSRC_BILLTYPE ,FSRC_BILLID );


 EXEC P_ALTERPK 'PK_FAH_EVT_TRACKER_EN', 'T_FAH_EVT_TRACKER_EN', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_EVT_TRACKER_EN' AND KSQL_INDNAME = 'IDX_FAH_EVT_TRACKER_EN') CREATE INDEX IDX_FAH_EVT_TRACKER_EN ON T_FAH_EVT_TRACKER_EN ( FSRC_BILLTYPE ,FSRC_BILLID );


 EXEC P_ALTERPK 'PK_FAH_VOUCHERENTRY_IF', 'T_FAH_VOUCHERENTRY_IF', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_VOUCHERENTRY_IF' AND KSQL_INDNAME = 'IDX_FAH_VOUCHERENTRY_IF') CREATE INDEX IDX_FAH_VOUCHERENTRY_IF ON T_FAH_VOUCHERENTRY_IF ( FID ,FSEQ );


 EXEC P_ALTERPK 'PK_FAH_VOUCHER_IF', 'T_FAH_VOUCHER_IF', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_VOUCHER_IF' AND KSQL_INDNAME = 'IDX_FAH_VOUCHER_IF') CREATE INDEX IDX_FAH_VOUCHER_IF ON T_FAH_VOUCHER_IF ( FREQUESTID );


 EXEC P_ALTERPK 'PK_FAH_TASK_SKIP_BILLS', 'T_FAH_TASK_SKIP_BILLS', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FAH_TASK_SKIP_BILLS' AND KSQL_INDNAME = 'IDX_FAH_TASK_SKIP_BILLS') CREATE INDEX IDX_FAH_TASK_SKIP_BILLS ON T_FAH_TASK_SKIP_BILLS ( FREQUESTID );


 EXEC P_ALTERPK 'PK_FAH_TASK_FAIL_BILLS_EN', 'T_FAH_TASK_FAIL_BILLS_EN', 'FENTRYID', '1';

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



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