SQL SERVER 2008 R2跟踪修改的表记录 [英] SQL SERVER 2008 R2 TRACK MODIFIED TABLE RECORDS

查看:460
本文介绍了SQL SERVER 2008 R2跟踪修改的表记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有任何选项可用于跟踪数据库上次登录时更新或修改的表记录?

I want to know that is there any option that I can use to track the updated or modified table records from the last log in of the database?

推荐答案

如果要访问已更新或删除或插入的记录,可以在要跟踪的表上创建触发器,并且可以从特殊表INSERTED,DELETED访问记录。



http://msdn.microsoft.com/en -us / library / aa214435(v = sql.80).aspx [ ^ ]



如果你想知道你使用的表的最后修改日期像这样的查询:

If you want to access the records that are Updated or deleted or inserted you can create the triggers on the table you want to track this and you can access the records from special tables INSERTED, DELETED.

http://msdn.microsoft.com/en-us/library/aa214435(v=sql.80).aspx[^]

If you want to know the last modified date of a table you use the query like this:
  SELECT OBJECT_NAME(OBJECT_ID) As DbName, Last_User_Update, 
  FROM sys.dm_db_index_usage_stats
  WHERE database_id = DB_ID('<your database="" name="">')

</your>





我希望我已经回答了你的问题。



I hope I have answered your question.


我发现了一篇很好的文章来解决我的问题。请参阅我在下面发布的链接!



在SQL Server 2008中设置更改数据捕获





http://www.techrepublic.com/blog/datacenter/setting-up-change-data-capture-in-sql-server-2008/1272 [ ^ ]



谢谢

Chiranthaka
I found a nice article that solve my problem. Please refer the link I have posted at the below!

Setting up Change Data Capture in SQL Server 2008


http://www.techrepublic.com/blog/datacenter/setting-up-change-data-capture-in-sql-server-2008/1272[^]

Thanks
Chiranthaka


这篇关于SQL SERVER 2008 R2跟踪修改的表记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆