Re: Getting a serial index back
Posted in 1995
Perry Dillard writes: * Why not just look at the sqlca.sqlerrd[2]. It contains the newly * assigned serial number after an insert. This is _way_ cheaper than * reselecting. It also resolves problems if another user inserts right after you did, and you SELECT MAX() and get the wrong value. * } From: "Pat O'Connor" <poconnor@internetmci.com> * } Subject: Re: Getting a serial index back * } Date: 3 Nov 1995 19:28:35 GMT * } To: informix-list@rmy.emory.edu * } * } Jeff Pickett <pickett@telerama.lm.com> wrote: * } > * } > Ok, this has got to be an easy one for the majority of you. So * } > here it is: * } > * } > I have a header record with a serial index on it, so after I * } > insert the header record into table 1, I would like to know what * } > that serial number is so I can put it in the detail record I * } > am about to insert into table 2. * } > * } > So how do I find what serial number was just used? * } > <snipped>> * } Ok - this is probably a hack, but it is what I did when faced * } with the same necessity. * } I selected the *indexed column* from the table using the header's * } unique keys following the insert and stored it for later use. * } * } * } * * -perryd (Guru) * * ==================================================================== * = Perry Dillard - Chief Architect = * = FourGen Software, Inc. = * = FourGen Building = * = 115 NE 100th Street = * = Seattle, W.A. 98125-8098 = * = = * = e-mail: perryd@fourgen.com Web Site http://www.fourgen.com = * ==================================================================== Robert Minter Data Systems Support \\\\\\_/// Senior Software Engineer A Client Technologies Company ( _ _ ) E-Mail: rob@dssmktg.com Tel: 714.771.0454 (| ^ |) #include <disclaimer.h> Fax: 714.771.3028 \\`-'/ De Colores - Emmaus OC-13 SURF'S UP \\_/