Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Foreign Key Reference to Multiple Table

Author  Topic 

miku
Starting Member

1 Post

Posted - 2004-11-01 : 00:16:17
Hi Guys,

I am trying to design a database. I have the following entities

company
stores
employees
customers

Now for each of the above entities, I require to store multiple phone numbers/emails/addresses. I was thinking of creating three tables phone, email and address to store that information. In each table, I would have have TableID field specifying which table (company,stores,employee,customer) is the row for and then RID field specifying the company ID or store ID etc for which the information is stored.

However, the problem is I dont understand if I can have referential integrity with this sort of schema. For examples, the RID field can reference any one of these (company,stores,employee,customer).

So what is the solution to this. I dont want to have multiple tables for each of the above entities and having multiple fields in their respective tables does not conform to NF rules.

Thank you.
Best Regards,
AC
   

- Advertisement -