Re: INSERT & ODBC
Posted in 1995
> Hi, > > I am sorry for the stupid question. > Does anyone know how to perform this action: > > There are two tables - one with primary key (SERIAL) and other with the > correspondent foreign key (INTEGER). I have to insert records into two > tables, > but the thing is that I don't know the value to insert into foreign key > column, > because I use ODBC calls and SQLCA is not accessible. It is possible to > do it > with triggers, but I don't believe it to be the only way! > > Thanks, > -- > -------------------------+------------------------ > Mikhail Krasuk | Phone : (095)977-02-12 > First Russian Bank | Fax : (095)210-86-66 > Head of programming team | E-mail : MKR@frb.msk.su > -------------------------+------------------------ > If you've got a Version 6+ engine, you can SELECT DBINFO(sqlerrd...) to get at (some of) the sqlca values, including the last serial value. I'm not sure whether this functionality is accessible via ODBC though. Otherwise, there's no alternative but to re-select the row you've just inserted based on some other unique key. akent@cix.compulink.co.uk (Andy Kent) -------------------------------------