Hopefully I'm not using incorrect terms, so let me explain to clarify what I'm trying to do.
Basically, I'm trying to create a database that will store information on businesses. So something like:
Table: Business Columns: BusinessID(PK Identity), Name, Address, City, State ,ZIP
Simple enough - but, where it gets more complex is that I need to keep that information per year, so I tried this:
Table: Business Columns: [BusinessID Identity, Year](PK), Name, Address, City, State ,ZIP
Meaning a composite PK of BusinessID(Identity) and Year. This works fine.
But, then I want to add other tables that are only based on the Business - irrespective of Year - such as Notes, and Sent/Received data for forms. So for this, I create these tables:
Table: Notes Columns: NoteID, BusinessID, Note, Date_Created, Date_Modified
Table: SentReceived Columns: SentReceivedID, BusinessID, FormID, Sent, Received, Date_Occurred
The idea here is that there can be multiple Notes per BusinessID and multiple SentReceived events per BusinessID - but neither being related to the Year.
I will setup a process where at the end of the year, all the Business accounts will be duplicated in the Business table, but with the current year used. Same BusinessID, but multiple years over the long term. This is so we can track changes to the Business data from year to year (there are obviously other columns beyond the basic address).
The problem is that I want to establish relationships between these tables and SSMSE will not do it since the tables have PKs that don't match. The Business table with BusinessID and Year PK, but with the Notes table with only BusinessID to link as a foreign key (and the same with the SentReceived table). Also, this sets up a situation where multiple Business records match multiple Notes and/or SentReceived. However, it would actually be a one BusinessID value to many Notes and/or SentReceived records. So I'm not sure if this fits the Many to Many relationship requiring a junction table?
So, at this point, with the possible Many-to-Many issue and with the relationship establishment issues, what I have done was to separate the BusinessID into it's own table:
Table: Business_ID Columns: BusinessID(PK Identity)
and then, I modified the Business table by taking the Identity setting off of BusinessID
I then setup relationships between Business and Business_ID, and junc_Business_Notes to Business_ID. Same with SentReceived. This ended up eliminating the problem of establishing relationships and made it so that there would only be a single Business_ID record per unique business, thus eliminating the Many-to-Many issues as well. But then this causes other issues, where say, connecting MS Access to these tables for data entry, would split the creating of a new business account over the 2 tables - causing setup in Access to be odd and more complicated (possibly resolved by a trigger setup on the Business table to create a new Business_ID account, using SCOPE_IDENTITY to supply the Business table with the newly create BusinessID). Ugh....!
Here's a portion of my database thus far - for visual clarity:
Anyway, I don't know what this kind of schema approach is called to be able to do proper searches for solutions and ideas. Adding the additional Year component to this (and a few other) table(s) really complicates matters. I though maybe some table auditing approaches might give me some insight into the issue as the PK is probably some unique record number with the main entityIDs of interest not being the PKs, but no luck thus far.
One other comment here, the Notes and SentReceived have a batch of other tables that also use them for Notes and SentReceived events for multiple other entities, thus I used junction tables to related them as they would end up having duplicate ID numbers between these entity tables, so one junction table per entity linked to Notes and SentReceived respectively.
I'm not looking for specific help with the tables discussed per say, but more looking for what I should be searching for to find solutions to this kind of setup or for specific sources covering something of this nature (books, sites, etc...) I'm sure someone has done this kind of things many times - I just can't find info on it.
Thanks in advance!
"When money ceases to be the tool by which men deal with one another, then men become the tools of men. Blood, whips and guns–or dollars. Take your choice–there is no other..."
- Ayn Rand - Atlas Shrugged