Subject Re: [firebird-support] How do I retrieve the primary key after an insert?
Author Martijn Tonies
Hello,

> Sorry for the newbie question, but I have a table with a UUID
> (compressed reversed GUID) as the primary key.
>
> I am using it as a link to a child table so I need to know what the
> value is before I write the child records.
>
> How is this done with firebird and also is it possible to do the whole
> thing in one trasaction?

I assume you're generating the GUID in a trigger...

The best way to do all this is:

1) get your GUID (eg: select myfunc from rdb$database)
2) save your master record, including the guid
3) save your child record

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server
Upscene Productions
http://www.upscene.com