Re: SELECTing the last value inserted into a SERIAL column
Posted in 1997
Topics: Connectivity: ODBC / JDBC / .NET, Data Types & Schema Design
Hari Muthuswamy wrote in article <7D42B70E761990F5.A7AEC73352936C4F.9DF11A6 CF94D31F1@library-proxy.airnews.net>... >Clay Amerault wrote: >> >> I have a table(a) where I want to use a unique number as the primary >> key. I had intended on using the data type SERIAL to do this, and >> letting the system merely increment it for each INSERT into table(a). >> However, I want to be able to capture the SERIAL value that was just >> inserted into table(a) so I can insert the value into another table(b). >> This would happen in the same transaction as the INSERT into table(a). >> Is there a way to retrieve the SERIAL value that was just INSERTed into >> table(a)? Or would I be better off using a nextkey table to hold the >> next value of the key to be inserted, and basically doing the job of the >> SERIAL data type manually? >> Thanks. >> >> -Clay Amerault > > > sqlca.sqlerrd[1] gives the value of the serial just inserted. > >Hari Muthuswamy > >TeleServioes Resources > Hi. I have a somewhat similar question. Does anybody know a way of accessing SQLCA using ODBC? I am using Informix-CLI APIs. I couldn't find any ODBC functions that give access to SQLCA. Thanx, Kostia.