Subject Re: [firebird-support] Generators Associated with a Table
Author Milan Babuskov
Martijn Tonies wrote:
> SET GENERATOR isn't allowed in a trigger.

:(

I guess I forgot about that.

You could then just replace PK value with max(PK) + 1, like this:

create trigger tx1 for table1
before insert
as
begin
if exists (select * from table1 where pk = new.pk) then
begin
select max(pk) from table1 into new.pk;
end
end

--
Milan Babuskov
http://fbexport.sourceforge.net