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)
 Need Opinions on Design Decision

Author  Topic 

DarylBlowes
Starting Member

1 Post

Posted - 2004-06-23 : 10:04:31
I have several tables representing different transactions (i.e. Resolutions, Communications, Statements, Motions, Hearings)

I need to create another table (MinuteItems) that can reference any of these records in any of these tables but only needs to reference one per MinuteItem record.

The question is do I build the table like:
MinuteItemID
ResolutionID
CommunicationID
StatementID
MotionID
HearingID

OR, do I do something like this:
MinuteItemID
ItemType <--- Indicates which table
RecordID <--- Indicates which record

The first one is nice because the referential integrity rules can be used however it wastes space. The second method is nice because it is simple, saves space and can easily be used if more tables need to be referenced in the future. However, the second one will require more coding of triggers for updates, inserts and deletes on all the referenced tables.

Decisions, decisions ??????

Any input is appreciated.... Daryl.

JimL
SQL Slinging Yak Ranger

1537 Posts

Posted - 2004-06-23 : 10:09:33
Jims Rule:

Any method that leaves you opportunity to add to with minimal change is preferable to one that does not. In short a little time now saves a lot of time later.



Jim
Users <> Logic
Go to Top of Page

samtoffa
Yak Posting Veteran

60 Posts

Posted - 2004-06-23 : 10:13:39
I faced a similar problem some time ago when I had to reference different tables containing data on thousands of vehicles in different countries. I tried both methods and then stuck with the second. Your reasons behind the choice are spot-on. If you don't expect to have many records then go for the first option, but if you are going to have many tables and many rows of data, the second option is worth the extra coding.
Sam
Go to Top of Page
   

- Advertisement -