Subject RE: [ib-support] Foreign keys
Author Alan McDonald
there are many ways to do this - what is the client being written in?
essentially you are doing
insert into insurance(clientFK, other, fields, etc) values (clientPKval,
other, values, etc);
you can build this sql dynamically on the client side, you can use
parameters, you can even create a new client and insurance record
simultaneously if you retrieve a new clientPK value before you do both
inserts. Some components do a lot of the hack work for you, other times you
may wish to do it manually anyway
Alan
-----Original Message-----
From: news@... [mailto:news@...]On Behalf Of
Jonathan M. Freedman
Sent: Saturday, 28 September 2002 0:26
To: ib-support@yahoogroups.com
Subject: [ib-support] Foreign keys


Given that i have only been using FB < 1 year and am an amatuer
programming,
this may be too basic to take seriously, but please bear with me and TIA:

There is a "master" table CLIENT, primary key CLIENTPK (a column, there
are
many others too).

There is a "detail" table INSURANCE, with a foreign key, CLIENTFK (a
column,
there are many others too). There are many insurance records per client.

I would like to insert a new record in INSURANCE with the CLIENTFK filled
with CLIENT.CLIENTPK. The user has already used a SELECT * FROM CLIENT
WHERE CLIENTPK = :clientpk. The problem is complicated further by: what
if
the user is running multiple SESSIONS (i think this is the meaning of
session), with multiple SELECT queries as above, open in multiple windows.

So, how do i get CLIENT.CLIENTPK into the INSERT for INSURANCE.CLIENTFK,
especially when i have multiple SELECTS for clients?




To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



[Non-text portions of this message have been removed]