Re: Retrieving correct SERIAL number of new row
Posted in 1997
"PRO" <olpe@ep.com> wrote: :After I insert a row containing a "SERIAL" column, how do I retrieve the :"serial number" of that row (I need to record that number elsewhere). : :I especially have a problem since multiple people may be inserting rows :very close to simultaneously; the row I insert may not be the last row :(highest SERIAL number) by the time I read it out. : :Please send suggestions to olpe@ep.com Thanks much in advance! : : -Pete- If you use 4GL or ESQL/C RTFM on the sqlca record (sqlca.sqlerrd[2] contains the last serial number after an insert in 4GL). In stored procedures in ver. 6.x or higher of the engine you use the dbinfo function. Engines prior to this version are more difficult. Check the FAQ for how to do it here. For other tools you either have to find a way to get hold of the sqlca record (some tools have that) or execute a stored procedure that returns the appropriate value using dbinfo (or the pre 6.0 way described in the FAQ. Generally it's a good idea to say something about the engine (type and version) and tool you are using. Without that it gets harder to answer. Nils.Myklebust@idg.no NM Data AS, P.O.Box 9090 Gronland, N-0133 Oslo, Norway My opinions are those of my company The Informix FAQ is at http://www.iiug.org