Subject Re: [firebird-support] auto increment field
Author Lee Jenkins
sp2gui wrote:
> is firebird support auto increment data type?
> (
> like 'serial8' data type in postgresql.
> like 'bigint auto_increment' in mysql.
> )
>
>
>

Yes, but its done through generators. Lookup generators in the docs.
Here is an example:

CREATE GENERATOR GEN_MNU_PRODUCTS_ID;

SET TERM ^ ;
/* Trigger on the Before Insert of the table */
CREATE TRIGGER MNU_PRODUCTS_BI FOR MNU_PRODUCTS
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
IF (NEW.MENUITEMID IS NULL OR
NEW.MenuITEMID = 0) THEN
NEW.MENUITEMID = GEN_ID(GEN_MNU_PRODUCTS_ID,1);
END
^
SET TERM ; ^


Most of the GUI admin tools for FB have little helpers (wizards?) that
make the generation of autoinc (Generator) fields easy.

http://ibexpert.com has a very nice admin tool. There are other really
nice ones out there too. IBExpert has a personal edition that you can
download from their site. I'm getting ready to purchase the full verion
since I like it so much.

Lee