Subject Re: [firebird-support] Autonumeric columns
Author Thomas Miller
No, unless there is a specific reason for having semi contigues
numbers. I use one generator
per module (we right accounting software). We have other system level
generators like
BSS_TRX_SEQGEN and BSS_BATCH_SEQGEN.

I know some programs that just use one for everything.

Flores José wrote:

>Miroslav:
>
>
>
>So this mean that I will have one trigger and one generator for every table
>with an auto-increment column. What system table holds generator's values?.
>
>I have a lot to learn, things like that I can create triggers with BEFORE
>clause, sounds good, I didn't see that at Mssql.
>
>
>
>And, thanks to Paul Beach for recommending Helen's book, here it is and I'm
>waiting for it:
>
>http://www.amazon.com/exec/obidos/tg/detail/-/1590592794/103-8534441-1951855
>?%5Fencoding=UTF8
><http://www.amazon.com/exec/obidos/tg/detail/-/1590592794/103-8534441-195185
>5?%5Fencoding=UTF8&v=glance> &v=glance
>
>
>
>Thank you.
>
>
>
>José.
>
>
>
>-----Mensaje original-----
>De: Miroslav Penchev [mailto:miroslavp@...]
>Enviado el: Tuesday, October 19, 2004 12:26 PM
>Para: firebird-support@yahoogroups.com
>Asunto: Re: [firebird-support] Autonumeric columns
>
>
>
>On Tue, 19 Oct 2004 11:32:43 -0500, Flores José
><jflores@...> wrote:
>
>
>
>>Hello,
>>
>>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?
>>
>>
>
>With triggers and generators like this:
>
>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 ; ^
>
>
>

--
Thomas Miller
Delphi Client/Server Certified Developer
BSS Accounting & Distribution Software
BSS Enterprise Accounting FrameWork

http://www.bss-software.com
http://sourceforge.net/projects/dbexpressplus