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

> 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?

No.

> 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)
AS...
...
newkey = gen_id(mygenerator, 1);
insert into mytables ... values (:newkey, lots of input parameters);
end

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com