Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski 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
Joined
Oct 3, 2006
Messages
1
Location
SE
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?

 
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

Back
Top