Keeping a history of data changes in database

前端 未结 7 960
醉梦人生
醉梦人生 2020-12-28 21:48

Every change of data in some row in database should save the previous row data in some kind of history so user can rollback to previous row data state. Is there any good pra

7条回答
  •  旧巷少年郎
    2020-12-28 22:33

    You can use triggers for that. Here is one example.

     AutoAudit is a SQL Server (2005, 2008)
     Code-Gen utility that creates Audit
     Trail Triggers with:
    
         * Created, Modified, and RowVerwsion (incrementing INT) columns to table
         * view to reconstruct deleted rows
         * UDF to reconstruct Row History
         * Schema Audit Trigger to track schema changes
         * Re-code-gens triggers when Alter Table changes the table
    

    http://autoaudit.codeplex.com/

提交回复
热议问题