Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations SDETERS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keep table data "versions"

Status
Not open for further replies.

mafm

Computer
Oct 3, 2006
1
Hello!

I have a kind of version problem where a table gets updated and some users still requires the old data from the table. What is the best approach to this problem?

 
Replies continue below

Recommended for you

I'll create a trigger on the BeforeUpdate event of the updating table. Here you have access to the OLD values as well for the NEW ones. So, let's say, having a History table the sql in the trigger should be like:
insert into history (a,b,c...) values (old.a,old.b,old.c ...)
You can insert the whole record or just those values where old one <> new one. Make a foreign key in the History table linked to the primary key of the updating one.

HTH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor