Running a ChangeLog with Triggers

Last Post 12 Feb 2006 12:11 AM by SQLUSA. 1 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
CSalvatore
New Member
New Member

--
03 Feb 2006 12:37 AM
Hi

I have a Database in which I have to create a ChangeLog.

Temporarely I add a New Record manually at the end of any change in the Application. Now I whish to change this to Triggers.

In The Changelog I have to record the following infrmation:
    Date of the Change
    Time of the Change
    User who eperformed the Change
    Table in which the Change was done
    The ID of the changed Record
    A Detailed Description of the change


At this time the code works very well to write these thing to the ChangeLog. But when somebody have to change or extend the Application he has to think about the ChangeLog and add the extra code.

I never looked at the Trigger feature. The Documentation in the Book Online is not enough for me to achieve what I need.

Can somebody help me, please?

Any help will be appreciated.

Cheers
Salvatore
MCSE
Germany
SQLUSA
New Member
New Member

--
12 Feb 2006 12:11 AM
You can do it with a trigger on the table. Trigger for INSERT, UPDATE and DELETE.

You would have to do it for each table.

Triggers are commonly used in large organization when to implement auditing or business rules is difficult due to the diverse app environment.

If you have control over the dev environment, it is better to implement in stored procedures.

Who did the change is different. That has to be part of the data model like row maintenance columns:

ModifiedDate
CreatedDate
StaffID
IsActive

Kalman Toth, Database Architect
http://www.sqlusa.com/orderdoubleheader/
The Best SQL Server 2005 Training in the World


You are not authorized to post a reply.

Acceptable Use Policy