[dba-SQLServer] Update Foreign Keys

Dan Waters df.waters at comcast.net
Fri Jul 15 08:43:19 CDT 2011


I think I'd do something like:

Create a tblMachineHistory table which shows MachineID and LocationID.  Have
fields for Active, EnteredBy and EnteredDate.  When a machine is moved, add
a new record for that machine and make that record Active.  Keep the
historical records which show the location for each machine.

When a new record is recorded with your assessment/measurement information,
the Machine record can have the LocationID entered by your code where the
LocationID comes from the lookup table.

Now, you can recall location history for the machine, and know where the
machine was when the record was created.

Of course ... don't change the machine ID!

HTH,
Dan






More information about the dba-SQLServer mailing list