Subject Re: [firebird-support] get to AutoInc value
Author Martijn Tonies

> I use a stored procedure to insert data into a table. In the table a
> field is autoincremented. Is it possible to return the value of this
> field by this stored procedure?


> Or do I've to query the database for knowing the autoincremented value?

You cannot do this in a decent way in a multi-user system.

The best thing you can do is:

CREATE PROCEDURE myproc (input) RETURNS (newkey integer)
newkey = gen_id(mygenerator, 1);
insert into mytables ... values (:newkey, lots of input parameters);

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Upscene Productions