Subject | Newbie Firebird SQL Question |
---|---|
Author | Myles Wakeham |
Post date | 2005-02-22T06:04:50Z |
I have to insert a row into a Firebird SQL database, into a table that has a
foreign key reference to a table of 'Categories'. The value that I'm know
is the textual representation of the category, and so in order for me to
insert the master record into the Primary table, I must first know the ID
number of this Category to update record with the correct Foreign key ID.
Without writing a SP to do this, what is the easiest way to do this in a
single SQL Insert statement? Basically I know all the other fields to
update except this one. Is it possible to combine a SELECT statement into
an INSERT statement? Can anyone give an example of how this is normally
done?
Thanks in advance for any help.
Regards,
Myles
===========================
Myles Wakeham
Director of Engineering
Tech Solutions Inc.
Scottsdale, Arizona USA
Phone (480) 451-7440
Web: www.techsol.org
foreign key reference to a table of 'Categories'. The value that I'm know
is the textual representation of the category, and so in order for me to
insert the master record into the Primary table, I must first know the ID
number of this Category to update record with the correct Foreign key ID.
Without writing a SP to do this, what is the easiest way to do this in a
single SQL Insert statement? Basically I know all the other fields to
update except this one. Is it possible to combine a SELECT statement into
an INSERT statement? Can anyone give an example of how this is normally
done?
Thanks in advance for any help.
Regards,
Myles
===========================
Myles Wakeham
Director of Engineering
Tech Solutions Inc.
Scottsdale, Arizona USA
Phone (480) 451-7440
Web: www.techsol.org