EXEC P_ALTERPK 'PK_FMM_MILE_PHAS', 'T_FMM_MILE_PHAS', 'FID', '1'; 

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FMM_MILE_PHAS_FNUMBER') CREATE INDEX IDX_FMM_MILE_PHAS_FNUMBER ON T_FMM_MILE_PHAS (FNUMBER);

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FMM_MILE_PHAS_FCREATETIME') CREATE INDEX IDX_FMM_MILE_PHAS_FCREATETIME ON T_FMM_MILE_PHAS (FCREATETIME);


EXEC P_ALTERPK 'PK_FMM_MILE_PHAS_L', 'T_FMM_MILE_PHAS_L', 'FPKID', '1';

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

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FMM_MILE_PHAS_L_FNAME') CREATE INDEX IDX_FMM_MILE_PHAS_L_FNAME ON T_FMM_MILE_PHAS_L (FNAME);


EXEC P_ALTERPK 'PK_FMM_PLANAREAWA', 'T_FMM_PLANAREAWA', 'FID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FMM_PLANAREAWA_FNUM') CREATE INDEX IDX_FMM_PLANAREAWA_FNUM ON T_FMM_PLANAREAWA (FNUMBER);

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FMM_PLANAREAWA_FCTE') CREATE INDEX IDX_FMM_PLANAREAWA_FCTE ON T_FMM_PLANAREAWA (FCREATETIME);


EXEC P_ALTERPK 'PK_FMM_PLANAREAWA_L', 'T_FMM_PLANAREAWA_L', 'FPKID', '1';

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

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FMM_PLANAREAWA_L_FNAME') CREATE INDEX IDX_FMM_PLANAREAWA_L_FNAME ON T_FMM_PLANAREAWA_L (FNAME);


EXEC P_ALTERPK 'PK_FMM_MPDMAREA_D', 'T_FMM_MPDMAREA_D', 'FENTRYID', '1';

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


EXEC P_ALTERPK 'PK_FMM_PLANNINGAREA', 'T_FMM_PLANNINGAREA', 'FID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FMM_PLANNINGAREA_FNUM') CREATE INDEX IDX_FMM_PLANNINGAREA_FNUM ON T_FMM_PLANNINGAREA (FNUMBER);

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FMM_PLANNINGAREA_FCTE') CREATE INDEX IDX_FMM_PLANNINGAREA_FCTE ON T_FMM_PLANNINGAREA (FCREATETIME);


EXEC P_ALTERPK 'PK_FMM_PLANNINGAREA_L', 'T_FMM_PLANNINGAREA_L', 'FPKID', '1';

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

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FMM_PLANNINGAREA_L_FNAME') CREATE INDEX IDX_FMM_PLANNINGAREA_L_FNAME ON T_FMM_PLANNINGAREA_L (FNAME);


EXEC P_ALTERPK 'PK_FMM_PROPGGROUP', 'T_FMM_PROPGGROUP', 'FID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FMM_PROPGGROUP_FNUM') CREATE INDEX IDX_FMM_PROPGGROUP_FNUM ON T_FMM_PROPGGROUP (FNUMBER);

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FMM_PROPGGROUP_FCTE') CREATE INDEX IDX_FMM_PROPGGROUP_FCTE ON T_FMM_PROPGGROUP (FCREATETIME);


EXEC P_ALTERPK 'PK_FMM_PROPGGROUP_L', 'T_FMM_PROPGGROUP_L', 'FPKID', '1';

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

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FMM_PROPGGROUP_L_FNAME') CREATE INDEX IDX_FMM_PROPGGROUP_L_FNAME ON T_FMM_PROPGGROUP_L (FNAME);


EXEC P_ALTERPK 'PK_FMM_OPTGROUPD', 'T_FMM_OPTGROUPD', 'FENTRYID', '1';

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