 EXEC P_ALTERPK 'PK_ER_COSTESTIMATEBILL', 'T_ER_COSTESTIMATEBILL', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_COSTEST_FBNO') CREATE INDEX IDX_ER_COSTEST_FBNO ON T_ER_COSTESTIMATEBILL ( FBILLNO );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_COSTEST_FBSTA') CREATE INDEX IDX_ER_COSTEST_FBSTA ON T_ER_COSTESTIMATEBILL ( FBILLSTATUS );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_COSTEST_FAPER') CREATE INDEX IDX_ER_COSTEST_FAPER ON T_ER_COSTESTIMATEBILL ( FAPPLIERID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_COSTEST_FDATE_NO') CREATE INDEX IDX_ER_COSTEST_FDATE_NO ON T_ER_COSTESTIMATEBILL ( FBIZDATE ,FBILLNO );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_COSTEST_FCREATEOR') CREATE INDEX IDX_ER_COSTEST_FCREATEOR ON T_ER_COSTESTIMATEBILL ( FCREATORID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_COSTEST_FCOMPANYID') CREATE INDEX IDX_ER_COSTEST_FCOMPANYID ON T_ER_COSTESTIMATEBILL ( FCOMPANYID );


 EXEC P_ALTERPK 'PK_ER_COSTESTIMATEBILL_L', 'T_ER_COSTESTIMATEBILL_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_ER_COSTESTIMATEBILL_LK', 'T_ER_COSTESTIMATEBILL_LK', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_ER_COSTESTIMATEBILL_TC', 'T_ER_COSTESTIMATEBILL_TC', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_COSTEST_TC_FTBLD') CREATE INDEX IDX_ER_COSTEST_TC_FTBLD ON T_ER_COSTESTIMATEBILL_TC ( FTBILLID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_COSTEST_TC_FSBLD') CREATE INDEX IDX_ER_COSTEST_TC_FSBLD ON T_ER_COSTESTIMATEBILL_TC ( FSBILLID );


 EXEC P_ALTERPK 'PK_ER_COSTESTIMATEBILL_WB', 'T_ER_COSTESTIMATEBILL_WB', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_ER_COSTESTIMATEENTRY', 'T_ER_COSTESTIMATEENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_COSTESTENTRY_FSEQ') CREATE INDEX IDX_ER_COSTESTENTRY_FSEQ ON T_ER_COSTESTIMATEENTRY ( FID ,FSEQ );


 EXEC P_ALTERPK 'PK_ER_COSTESTIMATEENTRY_LK', 'T_ER_COSTESTIMATEENTRY_LK', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_ER_COSTESTIMATEOWER', 'T_ER_COSTESTIMATEOWER', 'FPKID', '1';

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