Serial (autoincrement) field access
Posted in 1998
Troy Peterson — — source: Informix-list mailing list archive (1991-1998)
I know this sounds dumb, but... I have 3 fields in the primary key for my table and one of them is of 'serial' type. I want to insert a record into this table and then use the auto-assigned serial number from this field in a batch of records for another table. It seems awful sloppy to have to insert the record, run a query to try and find the record I just inserted, and then create my secondary batch of records. In my case this could result in multiple rows being returned and then I'm up a creek. Is there any way I can get my 'insert' to return the value of the autoincrement field? Is there a system variable that can be used? Any light you can shed on this topic would be greatly appreciated.