EXEC P_ALTERPK 'PK_MSPLAN_FLEXMETRICDEFINE', 'T_MSPLAN_FLEXMETRICDEFINE', 'FID', '1';

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

EXEC P_ALTERPK 'PK_MSPLAN_FLEXMETRICDEFINE_L', 'T_MSPLAN_FLEXMETRICDEFINE_L', 'FPKID', '1'; 

EXEC P_ALTERPK 'PK_MSPLAN_FLEXVALS', 'T_MSPLAN_FLEXVALS', 'FENTRYID', '1';

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

EXEC P_ALTERPK 'PK_MSPLAN_REPLACESETTING', 'T_MSPLAN_REPLACESETTING', 'FDETAILID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MSPLAN_REPLACESETTING') CREATE INDEX IDX_MSPLAN_REPLACESETTING ON T_MSPLAN_REPLACESETTING ( FENTRYID ,FSEQ );