Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

Foreign Key and auto update
I am new to developing a Many-to-Many DB.  The current design includes:  tbl
_patient, tbl_patient_visit, tbl_visit, and multiple assessments such as tbl
_vital_signs, tbl_family_history and etc.

The PK in tbl_patient is pt_id with a FK in tbl_patient_visit being pt_id.  
Additionally, the PK in tbl_visit is v_id with a corresponding FK in tbl_pat
ient_visit.  Furthermore, the various assessment foreign keys are in the tbl
_Visit with a separate table for each assessment.

All PKs are "auto numbers" with cascadeing foreign key.  

However, the foreign key field in the child table does not update automatica
lly.  It has been recommended that I provide a trigger to maintain this func
tion.

I can understand using a trigger, however, I then have a problem with the tb
l_visit, which has all the assessments referenced as a forein key.  I expect
 that all assessments would need to be completed at each visit in order for 
a row in the tbl_visit to update.  This is a problem because not all assessm
ents are completed at each visit.  My thought was to make the FK "NULL", how
ever the PK is an autonumber and must match in that it does not allow null. 
 

Your assistance in this matter is much appreciated.

Report this thread to moderator Post Follow-up to this message
Old Post
ldt
01-20-06 03:32 PM


Sponsored Links





Last Thread Next Thread
Post New Thread

Microsoft SQL Server forum archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 04:16 AM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006