Solved

track database changes

Posted on 2010-11-24
4
340 Views
Last Modified: 2012-06-27
How can i track changes in an sql server 2005 database?

For example, if I wanted to know the inserts,deletes and edits(original and after) that occurred in a certain day- how can i do that?
0
Comment
Question by:NormanMaina
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 25

Accepted Solution

by:
Luis Pérez earned 125 total points
ID: 34203375
The easiest way: create a datetime field in the table with default value to GETDATE(). So in each record saved, you will have the date and time it has been saved.

But that doesn't work for deletes, of course, because the deleted record is no longer in the database. For that case a good option is to use a Trigger for delete and track the date and time and the unique ID of the deleted record in another table.

If you want to know more about triggers, check this:
http://www.codeproject.com/KB/database/TriggersSqlServer.aspx

Hope that helps.
0
 
LVL 17

Assisted Solution

by:sweetfa2
sweetfa2 earned 125 total points
ID: 34203377
create triggers to farm the data off to a data warehouse for the data that you are interested in.
0
 
LVL 16

Assisted Solution

by:EvilPostIt
EvilPostIt earned 125 total points
ID: 34203386
In SQL Server 2008 there is CDC which i have included a link for, but i see you are using SQL Server 2005.

http://msdn.microsoft.com/en-us/library/bb522489(v=SQL.100).aspx

With SQL Server 2005 you will have to create triggers to insert the data into an audit table.
0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 125 total points
ID: 34203971
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question