Log changes to database table with trigger

前端 未结 12 2288
醉梦人生
醉梦人生 2021-02-08 18:48

I am looking for a good way to log changes that occur on a particular set of tables in my SQL Server 2005 database. I believe the best way to do this is through a trigger that g

12条回答
  •  礼貌的吻别
    2021-02-08 19:28

    Be careful here, since triggers fire at the ROW level, not the SQL STATEMENT level. So, if someone does "DELETE FROM BIGTABLE", your trigger will fire for each row in that table (this specifically in regard to the fact that you want to know the SQL statement that performed the operation, so you'll need to "figure that out" for every row the statement affects).

提交回复
热议问题