Hi all, I'm not sure how to phrase this question... I have a table that
requires a foreign key of another table - this foreign key is automatically
generated and the key field in the 'foreign' table. So I have the following
situation (kind of):

Table *Observation*

*Time_Stamp* - *primary key*

...

Observation_ID - *foreign key*

Table *Observation_Value*

*Observation_ID* - *primary key*

...

So obviously I need to insert into the table *Observation_Value* first
before I can insert into table *Observation*, but how to I get the
automatically generated foreign key?

I was thinking of using a trigger - when a value is inserted into *
Observation_Value* then add the primary key to a new table (probably a view)
and get that value for insertion into *Observation* then drop temporary
table. I wanted to know if there's an easier way to do this? I can't change
the table structure in any way either.... any help would be appreciated. I'm
not even sure what type of search query I should use to find help on this
topic either...

Regards,
Pooven

Reply via email to