Subject | Re: [firebird-support] Autonumeric columns |
---|---|
Author | Miroslav Penchev |
Post date | 2004-10-19T17:26:19Z |
On Tue, 19 Oct 2004 11:32:43 -0500, Flores José
<jflores@...> wrote:
CREATE GENERATOR GEN_ADDRESS_ID;
SET TERM ^ ;
CREATE TRIGGER ADDRESS_BI_BI FOR ADDRESS
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
IF (NEW.ADDRESS_ID IS NULL) THEN
NEW.ADDRESS_ID = GEN_ID(GEN_ADDRESS_ID,1);
END
^
SET TERM ; ^
--
Miroslav Penchev
<jflores@...> wrote:
> Hello,With triggers and generators like this:
>
> I'm moving to Firebird
>
>
>
> At MS SQL i have an option to create autonumeric columns
>
> With this: IDENTITY (seed, increment )
> ...
> How can I do the same with Firebird?
CREATE GENERATOR GEN_ADDRESS_ID;
SET TERM ^ ;
CREATE TRIGGER ADDRESS_BI_BI FOR ADDRESS
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
IF (NEW.ADDRESS_ID IS NULL) THEN
NEW.ADDRESS_ID = GEN_ID(GEN_ADDRESS_ID,1);
END
^
SET TERM ; ^
--
Miroslav Penchev