CREATE TABLE HOSPEDE (
ID_HOSPEDE INTEGER NOT NULL PRIMARY KEY,
NOME VARCHAR(90),
ID_ENTRADA INTEGER,
BAIXA CHAR(1)
);

CREATE GENERATOR GEN_ID_HOSPEDE ;

SET TERM ^;

CREATE TRIGGER TRIG_GEN_ID_HOSPEDE FOR HOSPEDE
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
   NEW.ID_HOSPEDE = gen_id(GEN_ID_HOSPEDE,1);
END
^

COMMIT WORK^
SET TERM;^
