Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 back up record before update

Author  Topic 

KlausEngel
Yak Posting Veteran

85 Posts

Posted - 2010-10-06 : 12:23:42
I am extracting customer information data from my production database into my analysis database on a daily basis.
Customer records can be added or edited. I have a solution for making the additions and editions but I would like to add a functionality to insert a record into a 'historic' type table for every update that I make on a record in the analysis table.
So let's say the street address information changes in the production table I would like to update the corresponding record in my analysis table AND add a record into an archive table with the value prior to making the update.
Does anyone have a suggestion on how to do that?

Thanks for your help.

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2010-10-06 : 13:36:19
A trigger on your analysis table that inserts to an audit table would do it. Search on "audit trigger" for a lot of examples.

Be One with the Optimizer
TG
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-10-07 : 02:24:03
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=170215
Go to Top of Page
   

- Advertisement -