Subject RE: [firebird-support] Autonumeric columns
Author Flores José
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 ; ^

--
Miroslav Penchev






Yahoo! Groups Sponsor



ADVERTISEMENT

<http://us.ard.yahoo.com/SIG=1298f83t4/M=295196.4901138.6071305.3001176/D=gr
oups/S=1705115386:HM/EXP=1098293192/A=2128215/R=0/SIG=10se96mf6/*http:/compa
nion.yahoo.com> click here



<http://us.adserver.yahoo.com/l?M=295196.4901138.6071305.3001176/D=groups/S=
:HM/A=2128215/rand=596873333>



_____

Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/
<http://groups.yahoo.com/group/firebird-support/>


* To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
<mailto:firebird-support-unsubscribe@yahoogroups.com?subject=Unsubscribe>


* Your use of Yahoo! Groups is subject to the Yahoo! Terms of
<http://docs.yahoo.com/info/terms/> Service.



[Non-text portions of this message have been removed]