Maintaining Row history

  • I have a Transaction table. That undergo many changes recordwise. Now my Manager ask me to record the changes made for any particular row in my SQL Server table. That is maintaining Row History. Which users made changes to any row. The situation is n number of user may change a particular row., so in this context how do i do that.

    This is most urgent task for me. I thought of keeping an extra column in table. But that won't help me. Bcz., that will maintain only one user who made changes. But I want Row history. Can any one help me.

     

    Thanx

  • Hi,

    One way to do this is to:

    1. Create a new log table that contains all the columns from the table you want to log and an additional column for the username.

    2. Create a trigger on the table you want to log that detects changes and when one occurs inserts a row into the log table.  Include all the data in the record that changed plus the name of the user that caused the change.

    Now each time a change is made a complete backup is made of the orginal rows along with the user who changed then.  Could work for new inserts too.

    Good luck.

  • Due to performance issue, I want to achieve this one with out using a trigger.

    And for all tables I need to create trigger and validate.

    Is there any other way to do this.

     

  • Ask you manager about purchasing Lumigent Log Explorer.  It is not that expensive and you will be able to use it for all your tables with little performance issues.  You will also get some extra benefits from the product.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply