CREATE GENERATOR GEN_MEDIA_POINTEURS_ID;
SET GENERATOR GEN_MEDIA_POINTEURS_ID TO 0;

SELECT GEN_ID( GEN_MEDIA_POINTEURS_ID, 
  (SELECT MAX(MP_CLEF) FROM MEDIA_POINTEURS) - GEN_ID(GEN_MEDIA_POINTEURS_ID, 0)) FROM RDB$DATABASE;

set term !! ;
CREATE TRIGGER UTILISATEUR_GEN FOR MEDIA_POINTEURS
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
if (NEW.MP_CLEF is NULL) then NEW.MP_CLEF =GEN_ID(GEN_MEDIA_POINTEURS_ID, 1);
END!!
set term ; !!

UPDATE T_VERSION_BASE SET VER_VERSION='5.181';
COMMIT WORK;
