Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert with a ManyToMany reference table.

Status
Not open for further replies.

skiflyer

Programmer
Sep 24, 2002
2,213
0
0
US
Table 1: Staff PK: staff_id
Table 2: owner_has_staff: FK to the above, plus some other fields (including a FK to an entirely other database)

Is there a way to do a single insert which handles table two?

Something akin to
INSERT INTO staff (...) VALUES (...);
staff_id = CURRVAL(sequence);
INSTERT INTO owner_has_staff(...) VALUES (...);

Or do I need to break it up like that?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top