Re: Q: How obtain ID assigned by Informix Serial datatype from PC Client (C++/MFC)
Posted in 1996
Marius Dreyer <dreyermg@xpoint.co.za> wrote: :Malin Goodwin wrote: :> :> I have an Informix Database where I use SERIAL :> datatype to generate unique id's. If a new :> row is inserted with id = 0, informix will assign :> the next available id. :> :> I need to use the new id (that informix assigned) :> to insert a related row in a second table. :> :> Question: :> How/Can I achieve this from a :> PC Client written in microsoft C++/MFC :> with Recordsets (using OpenLink :> ODBC Driver ) ? ... code sniped... :I think in the sqlca you can get the value of the serial you just inserted. :Cheers There is no sqlca under ODBC. Others have reported something about using a stored procedure and having that return this information using dbinfo. I haven't tried, but it should be easy enough to try it. You would have to call it immediately after the update so no other sql commands have been executed from your session before the procedure is called. It is a very sad situation that Informix doesn't show the least kind of interest for problems like this. It should be documented by them how to do it in a special manual relating to ODBC usage through different tools, with examples from some of the most used languages and other products (such as PB, VB, MS Access, MSVC, Delphi and perhaps a few others). Informix would benefit tremendously from creating such a manual. As I don't believe Informix will ever see the light on this issue, may be IIUG could assemble more tricks of the trade in this area and put it into a separate part of the current FAQ. 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