Subject | Re: Select max(id) is slow ? |
---|---|
Author | hannes@dwscript.com |
Post date | 2001-09-18T11:42:08Z |
--- In ib-support@y..., Carsten Schäfer <ca_schaefer@g...> wrote:
query the generator in the SP and return the value.
(just e few lines more to write)
and skip the before insert trigger.
example:
CREATE PROCEDURE "Atable_ID_AutoInc" (pcol1 integer, pcol2 varchar..)
RETURNS (NEW_VALUE INTEGER)
AS
BEGIN
NEW_VALUE = GEN_ID(TAUTO_ID, 1);
insert into atable (id, col1, col2..)
values(NEW_VALUE , :pcol, pcil2..);
suspend;
END
hope thats what you want,
hannes hernler
--------------------------------------------------------
DWS - Delphi Web Script
developing professional web apps
look at http://www.dwscript.com
--------------------------------------------------------
> ...auto-increment primary key (id_apos) on a tableyou could use a stored proc for inserting
> t_apos
> (generator gen_apos that is used in a before insert trigger).
> Now i want to put the new id that is given from the generator in my
> object that was inserted.
query the generator in the SP and return the value.
(just e few lines more to write)
and skip the before insert trigger.
example:
CREATE PROCEDURE "Atable_ID_AutoInc" (pcol1 integer, pcol2 varchar..)
RETURNS (NEW_VALUE INTEGER)
AS
BEGIN
NEW_VALUE = GEN_ID(TAUTO_ID, 1);
insert into atable (id, col1, col2..)
values(NEW_VALUE , :pcol, pcil2..);
suspend;
END
hope thats what you want,
hannes hernler
--------------------------------------------------------
DWS - Delphi Web Script
developing professional web apps
look at http://www.dwscript.com
--------------------------------------------------------