SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Question on creating new tables to handle versions of data entry.


Question on creating new tables to handle versions of data entry.

Author
Message
Maxer
Maxer
SSCommitted
SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)

Group: General Forum Members
Points: 1924 Visits: 1625
Currently we collect data and every 3 to 9 months we have changes to the data we collect, usually new fields. What we have been doing is just adding columns and updating our data entry and save code to map t o the new columns and versioning off that code as well. Same for our SSRS reports.

What I was wondering is instead of trying to shoehorn this into the same table is just versioning off the existing table each time and adding the new column.

DataCollectionV2 (10 columns)
DataCollectionV3 (15 columns, 9 the same as the V2 table)
etc...

I feel as if this is wrong to generate all these tables, but trying to just add new columns and then never using the old columns again seems off as well.

Suggestions\thoughts?

I have also been debating a more vertical design more like a WH fact table.

Can anyone share any general thoughts/wisdom/personal stories?

Thanks!
Tom Thomson
Tom Thomson
One Orange Chip
One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)

Group: General Forum Members
Points: 26223 Visits: 12506
One possibility for this is to go into the Dace version of 6th normal form for columns affected by this, and use an anchor model. However, that may be overkill (I'm sure Chris Dave would say it's not; and I know i would say it probably is). You can get most of the benefits by moving attributes which are no longer used into separate tables, each new table having a bunch of attributes which all became obsolete at the same time together with the primary key attributes identifying what each row refers to, so that you don't need to have rows in the table for things which don't have values for its non-key columns - entries which use those attributes can be handled using joins from the main table to the relevant extra tables.

Personally, I suspect that you would be better of splitting into tables that have complete sets and avoiding the extra joins, as you seem to be suggesting as one option, as that achieves much the same space saving and equally removes the need for having to devise values to put in these columns if the new items thenew columns are required for business reasons not to be nullable and you want to enforce that as a domain constraint to help ensure data integrity.

It's probably not a good idea to keep all the old columns and all the new columns in one table as it restricts how much data integrity enforcement you can do using constraints. But if you don't need to do that sort of data integrity (something which is far more often believed that true, unfortunately) keeping all columns in the one table won't cause problems.

Tom

Maxer
Maxer
SSCommitted
SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)

Group: General Forum Members
Points: 1924 Visits: 1625
That all makes good sense.

I'll look into 6NF, but I think that may over-complicate things (as you suggested).

The real goal here is just to store the data. Since new columns are needed and all the old ones retired each time we version change, it does seem that just versioning off the tables makes good sense.

What makes things worse about the current approach is that sometimes (say two or three versions later) a discontinued column is brought back into use which just complicates tracking what was used for which version and when Smile
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search