Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 3 of 3 total |
How to get the value of a generated identity in a procedure... |
Mon, Apr 28 2008 9:55 AM | Permanent Link |
Uli Becker | I am sure I read it anywhere but cannot find it any more: How can I
return an auto-generated identity value after inserting a record from a stored procedure? I remember there is something different from (select max...) Thanks. Uli |
Mon, Apr 28 2008 2:02 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Uli,
<< I am sure I read it anywhere but cannot find it any more: How can I return an auto-generated identity value after inserting a record from a stored procedure? >> To retrieve the new identity column value in the procedure, use something like this: PROCEDURE "ReturnIdentity" (OUT "ResultIdentity" INTEGER) BEGIN DECLARE InsertStmt STATEMENT; PREPARE InsertStmt FROM 'INSERT INTO Customer (CustNo) VALUES (?)'; EXECUTE InsertStmt USING ResultIdentity; END One note - the EDB Manager currently isn't executing "output-param-only" procedures due to a bug, but they will work fine in your application. -- Tim Young Elevate Software www.elevatesoft.com |
Mon, Apr 28 2008 2:35 PM | Permanent Link |
Uli Becker | Tim
> To retrieve the new identity column value in the procedure, use something > like this: > > PROCEDURE "ReturnIdentity" (OUT "ResultIdentity" INTEGER) > BEGIN > DECLARE InsertStmt STATEMENT; > > PREPARE InsertStmt FROM 'INSERT INTO Customer (CustNo) VALUES (?)'; > EXECUTE InsertStmt USING ResultIdentity; > END Thank you! Regards Uli |
This web page was last updated on Tuesday, April 30, 2024 at 03:55 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |