Subject Re: Getting id of last inserted record
Author hay77772000
Hi. Thanks for speedy reply...

> To have a reliable access to the id of last inserted record you
have no
> other option but to get the generator value on the client side.
>
> Depending on the tools you use there are different ways to do it
(but
> you can always do it the way you did above).
I thought this wasn't reliable though...?

> To keep your db operatable outside the client-app you can supply a
value
> in a before insert trigger by checking for NULL on the id field
> (like: IF ( NEW.ID IS NULL ) THEN NEW.ID = GEN_ID ....)
My current trigger is as follows:
CREATE TRIGGER ACCOUNTS_BI FOR ACCOUNTS
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
IF (NEW.ID IS NULL) THEN
NEW.ID = GEN_ID(GEN_ACCOUNTS_ID, 1);
END ^
commit ^
SET TERM ; ^

but how does this help?!

Sorry for the slowness on my part!

Cheers,

David