Is there any sql script to find out when the database in SQL server is last updated?
有没有sql server中的数据库最近一次更新的sql脚本?
I want to know the last updated date time for the changes done on meta data of the database rather than actual data inside the table. Particularly when:
我想知道对数据库的元数据而不是表中实际数据所做的更改的最后更新日期时间。特别是当:
- Any new table is created/dropped from Database.
- 从数据库中创建/删除任何新表。
- Any new column is added/removed from table in the Database.
- 从数据库中的表中添加/删除任何新列。
- Any new views/Stored Procedures/Functions are added/altered inside the Database.
- 任何新的视图/存储过程/函数都在数据库中添加/修改。
2 个解决方案
#1
15
Look in sys.objects should be enough, try this query
看系统。对象应该足够,请尝试此查询
select * from sys.objects
order by modify_date desc
#2
4
This will return last modified date time + name of updated item + description what was updated (table, stored procedure, etc)
这将返回最后修改的日期时间+更新项的名称+更新的描述(表、存储过程等)
SELECT TOP 1 name, modify_date, type_desc
FROM sys.objects
ORDER BY modify_date DESC
#1
15
Look in sys.objects should be enough, try this query
看系统。对象应该足够,请尝试此查询
select * from sys.objects
order by modify_date desc
#2
4
This will return last modified date time + name of updated item + description what was updated (table, stored procedure, etc)
这将返回最后修改的日期时间+更新项的名称+更新的描述(表、存储过程等)
SELECT TOP 1 name, modify_date, type_desc
FROM sys.objects
ORDER BY modify_date DESC