EXEC P_ALTERPK 'PK_MSPLAN_PRIMODEL', 'T_MSPLAN_PRIMODEL', 'FID', '1';

EXEC P_ALTERPK 'PK_MSPLAN_PRIMODEL_L', 'T_MSPLAN_PRIMODEL_L', 'FPKID', '1'; 

EXEC P_ALTERPK 'PK_MSPLAN_PMODELENTRY', 'T_MSPLAN_PMODELENTRY', 'FENTRYID', '1';

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

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

