Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Insert new records across multible tables
Wed, Aug 16 2006 7:02 PMPermanent Link

Brent
I have two tables.

Master table is PatientInfo

Fields are: SSAN, Name, Phone


Detail table is PatientNotes

Fields are: SSAN, Date, Notes


I would like to be able to insert a new record in PatientInfo table and at the same time, create a new record in the PatientNotes table. The key or link is the SSAN field.


Any help would be greatly appreciated in showing me how to do this.

Brent
Thu, Aug 17 2006 3:26 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Brent


add the record to PaitientInfo and post it THEN add the record to PaitientNotes using

PatientNotesSSAN.Assign(PatientInfoSSAN);


Wrap in a transaction just in case and you're there


Roy Lambert
Fri, Aug 25 2006 8:50 AMPermanent Link

adam
Dear Brent,

A key issue with your request is whether the system is multi-user. If not you can write something like:

---

INSERT INTO Table1
(SAAN, otherfields ...)
(values ....)

;

INSERT INTO Table
(fields ...)
SELECT Max(SAAN)

FROM Table1

---

If the system is multi-user the easiest way is to create the SAAN in Delphi, or via some kind of trigger then use it as a Param and pass it into the
SQL in code with 2 SQL snippets that have space to accept the params.






Image