Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / March 2006

Tip: Looking for answers? Try searching our database.

How to get generated key back in php/db2 v8.1.9 Linux

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bob Stearns - 22 Mar 2006 23:26 GMT
I am doing an insert into a table with a generated key. How do I obtain
the generated key of the record I just inserted?
Chris - 23 Mar 2006 00:42 GMT
Try

select gen_key from final table(insert into your_table (columns) values
(values))

That is, select the generated key as part of the insert statement.

I really, really like that feature.

-Chris
Bob Stearns - 23 Mar 2006 05:33 GMT
> Try
>
[quoted text clipped - 6 lines]
>
> -Chris

Thank you very much. No doubt it is implied by the fine manuals, but I
sure didn't find it in the *[Ii]dent* samples in the samples directory.
Brian Tkatch - 23 Mar 2006 15:38 GMT
The manuals aren't perfect either. IMNSHO, you need to know what you
are looking for.

Although, one thing about is really nice. It lists possible error codes
when using bad parameters.

B.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.