/**Begin D:\PDM_UPGRADE\PDM1\FPM_constraint.sql **/
EXEC P_ALTERPK 'PK_T_FPM_REPORT_CURRENCY_BAK', 'T_FPM_REPORT_CURRENCY_BAK', 'FPKID', '1';

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


EXEC P_ALTERPK 'PK_T_FPM_REPORT_BAK_L', 'T_FPM_REPORT_BAK_L', 'FPKID', '1';

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


EXEC P_ALTERPK 'PK_T_FPM_REPORTDATAMAIN_BAK', 'T_FPM_REPORTDATAMAIN_BAK', 'FENTRYID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FPM_FIXDIMBAK') CREATE INDEX IDX_FPM_FIXDIMBAK ON T_FPM_REPORTDATAMAIN_BAK ( FORGMEMID ,FCURRENCYMEMID ,FPERIODMEMID ,FSUBJECTMEMID );


EXEC P_ALTERPK 'PK_T_FPM_REPORTDATADETAILBAK', 'T_FPM_REPORTDATADETAILBAK', 'FENTRYID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FPM_MAINENTRYBAK') CREATE INDEX IDX_FPM_MAINENTRYBAK ON T_FPM_REPORTDATADETAILBAK ( FMAINDIMDATAID );


EXEC P_ALTERPK 'PK_T_FPM_REPORT_SUMRECORDBAK', 'T_FPM_REPORT_SUMRECORDBAK', 'FENTRYID', '1';

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


EXEC P_ALTERPK 'PK_T_FPM_REPORT_AUXILIARYBAK', 'T_FPM_REPORT_AUXILIARYBAK', 'FENTRYID', '1';

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


EXEC P_ALTERPK 'PK_T_FPM_ROWDATAID_SAVEBAK', 'T_FPM_ROWDATAID_SAVEBAK', 'FENTRYID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FPM_RDI_MAINENTRYBAK') CREATE INDEX IDX_FPM_RDI_MAINENTRYBAK ON T_FPM_ROWDATAID_SAVEBAK ( FMAINDIMDATAID );


EXEC P_ALTERPK 'PK_T_FPM_REPORT_PERIOD_BAK', 'T_FPM_REPORT_PERIOD_BAK', 'FPKID', '1';

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


EXEC P_ALTERPK 'PK_T_FPM_OLAPSYNCLOG', 'T_FPM_OLAPSYNCLOG', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'INDEX_OLAPSYNCLOG_ENTITYID') CREATE INDEX INDEX_OLAPSYNCLOG_ENTITYID ON T_FPM_OLAPSYNCLOG ( FBODYSYSTEMID ,FENTITYID );


EXEC P_ALTERPK 'PK_T_FPM_REPORT_BAK', 'T_FPM_REPORT_BAK', 'FID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_REPORTORGBAK') CREATE INDEX IDX_REPORTORGBAK ON T_FPM_REPORT_BAK ( FREPORTORG );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_REPORTPERIODBAK') CREATE INDEX IDX_REPORTPERIODBAK ON T_FPM_REPORT_BAK ( FREPORTPERIOD );



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