EXEC P_ALTERPK 'PK_MSPLAN_KEYMATERIAL', 'T_MSPLAN_KEYMATERIAL', 'FID', '1';

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

EXEC P_ALTERPK 'PK_MSPLAN_KEYMATERIAL_L', 'T_MSPLAN_KEYMATERIAL_L', 'FPKID', '1'; 