Subject | RE: [firebird-php] Re: using auto_number field |
---|---|
Author | Alan McDonald |
Post date | 2004-06-04T13:47:22Z |
yes, this is the fast way to create, since no built-in function
on auto number field, anyway thanks for your helping....
the good amdin tools do all this for you - you just create the field and
say - make it a PK, create a generator for it or use an existing one, tick
boxes and OK
see IBExpert or DatabaseWorkbench
Alan
--- In firebird-php@yahoogroups.com, Dariusz Zelichowski
<z_darius@y...> wrote:
ADVERTISEMENT
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-php/
To unsubscribe from this group, send an email to:
firebird-php-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
on auto number field, anyway thanks for your helping....
the good amdin tools do all this for you - you just create the field and
say - make it a PK, create a generator for it or use an existing one, tick
boxes and OK
see IBExpert or DatabaseWorkbench
Alan
--- In firebird-php@yahoogroups.com, Dariusz Zelichowski
<z_darius@y...> wrote:
> //Do it through storep procedures and triggers.Yahoo! Groups Sponsor
>
>
> //Assume you have a table with a field:
>
> CITY_GEN INTEGER;
>
> //You want CITY_GEN to be auto incremented after every
> insert.
> //Create a Generator:
>
> CREATE GENERATOR GEN_CITIES_ID;
>
> //Set its value to 0
>
> SET GENERATOR GEN_CITIES_ID TO 0;
>
> //Create a trigger a Stored Procedure that will increment
> the Genreator by 1
>
> CREATE PROCEDURE SP_GEN_CITIES_ID
> RETURNS (
> ID INTEGER)
> AS
> BEGIN
> ID = GEN_ID(GEN_CITIES_ID, 1);
> END
>
> //Now create the trigger to call the above procedure before
> every INSERT operation:
>
> CREATE TRIGGER CITIES_BI FOR CITIES
> ACTIVE BEFORE INSERT POSITION 0
> AS
> BEGIN
> IF (NEW.CITY_GEN IS NULL) THEN
> NEW.CITY_GEN = GEN_ID(GEN_CITIES_ID,1);
> END
>
>
> That's all.
>
>
>
> --- corp_5 <hasan@d...> wrote:
> > is there any way to use auto number field in FB ??
> > maybe someone can help me,
> >
> > thankyou
> >
> >
>
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Friends. Fun. Try the all-new Yahoo! Messenger.
> http://messenger.yahoo.com/
ADVERTISEMENT
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-php/
To unsubscribe from this group, send an email to:
firebird-php-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.