如何判断表 sql 2005 上的上次更新/插入活动
我试图找出对 sql 2005 数据库中的特定表进行最后一次插入/更新的时间。 数据没有时间戳,所以我无法这样判断。 有没有 DMV 可以帮助我?
谢谢, hp
I am trying to find out when the last insert/update was done to a specific table in our sql 2005 db. The data does not have a timestamp, so I can not tell that way. Are there any dmv out there that would assist me in this?
Thanks,
hp
Duplicate: How to find recent sql update operations acting upon a certain table (SQL Server 2005)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我找到了一个可以帮助您的链接:
上次更新时间 来自 blog.sqlauthority.com
该帖子的一部分包含以下代码:其中“AdventureWorks”是目录名称,“test”是表名称
I found a link that could help you out:
Last Update Time from blog.sqlauthority.com
A part of that post contains this code: where 'AdventureWorks' is the Catalog name and 'test' is the table name
此代码:
工作正常,但如果您查看源表:sys.dm_db_index_usage_stats,您会意识到必须对该表建立索引才能使它们显示在此处。 您可能认为所有表都已建立索引,我们为数据仓库拍摄快照,并且不需要对这些表建立索引,但是我们确实希望向人们展示它们上次更新的时间。
如果您在 SQL 中创建一个没有索引的表并更新它/添加数据,那么 sys.dm_db_index_usage_stats 就会更新。 我们使用 SSIS 更新表,并且 sys.dm_db_index_usage_stats 中没有表的条目。
This code:
Works fine, but if you look at the source table: sys.dm_db_index_usage_stats you'll realise that table have to be indexed in order for them to show up in here. You maybe thinking surely all tables are indexed, we take snapshots for data warehousing and there is no need to index these tables however we do like to show people when they were last updated.
Whilst it appears if you create a table in SQL with no index and update it/add data this sys.dm_db_index_usage_stats gets updated. We update our tables with SSIS and there are no entries for our tables in sys.dm_db_index_usage_stats.