sql server - What is the best way to track when table(s) are updated in SQL? -


In the past I've just added one field to each table and updated it with GETDATE () when every update / insert . The problem is that I have to keep track of removal now. I was just thinking of getting a table which I change when something changes and adds a trigger to all the other tables ??? Thanks!

If you have a history table (table with the same column as the original table, plus an automatic pay Increase ID column), you can track everything about the change in the original table. You can inserts, deletes, and tracks every change Use the trigger to insert, update and delete to insert a line in the history table. If you do not need all these options, then use those you need.

If you choose to use an IsDeleted flag in the original table, it makes every query intriguing, and leaves your active table a lot of unnecessary rows but it depends on your needs could work.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -