Re: SERIAL: how to SELECT generated number?
Posted in 1997
"Andreas Schubert" <aschub@sax.sax.de> wrote: :Is there a way to get by SELECT statement the content of SQLERRD[2] -- the :generated serial number after INSERT? (not in ESQL environment, must be :single SQL query). The simplest way is: select dbinfo('sqlca.sqlerrd1') from sometable where condition_to_return_one_row_only which may be: select dbinfo('sqlca.sqlerrd1') from systable where tabid = 1 This actually works nice and avoids having to write a stored procedure or do anything else strange. It should work over ODBC and other connectivity software as well as long as you make sure the same connection is used and the ODBC driver or other software doesn't generate strange intermediate sql (usually no problem). Make sure this is the *very first* sql statement you execute directly after your insert. (I would not no commit or anything else.) This is documented in the manuals to work. :,,Perfection is achieved only in the point of collapse." (C.N.Parkinson) Parkinson had conceptual problems. 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