如何在数据库中找到最后修改

时间:2022-09-25 14:04:12

I have an application which stores all data in SQL Server 2008. This application creates, modifies, updates tables. The name of the database is XLPR_2001 and it contains nearly 500 tables.

我有一个应用程序,它存储SQL Server 2008中的所有数据。此应用程序创建,修改,更新表。数据库的名称是XLPR_2001,它包含近500个表。

I want to find out changes if I made through application where it affect the entire database (XLPR_2001). If I find it so I can directly made those changes directly in the database, I complete my work very fast.

我想知道如果我通过应用程序进行更改,它会影响整个数据库(XLPR_2001)。如果我发现它,所以我可以直接在数据库中直接进行这些更改,我可以非常快速地完成我的工作。

I search it on web but not help me in my case.

我在网上搜索但在我的情况下没有帮助我。

3 个解决方案

#1


0  

You can find this info at modify_date column of sys.objects table

您可以在sys.objects表的modify_date列中找到此信息

SELECT name, modify_date from sys.objects where type ='U' order by modify_date desc

#2


0  

As your Question, you are looking for Table Change Effect :

作为您的问题,您正在寻找表变更效果:

SELECT name [TableName],
       Create_date [CreateDate],
       modify_date [LastUpdate]
FROM sys.all_objects
WHERE type = 'U'
ORDER BY modify_date DESC;

From above SQL Command which would give you all Table_Name which are last effected by some activities (i.e. insert, update or delete).

从上面的SQL命令,它将为您提供最后受某些活动影响的所有Table_Name(即插入,更新或删除)。

Result :

如何在数据库中找到最后修改

#3


0  

@sarslash and @Yogesh in my case your code show very old result. I found below code on somewhere and it work perfectly.

在我的情况下,@ sarslash和@Yogesh你的代码显示非常古老的结果。我在某处找到了下面的代码,它完美地工作。

select
    object_name(object_id) as OBJ_NAME, *
from
    sys.dm_db_index_usage_stats
where
    database_id = db_id(db_name())
Order by
    dm_db_index_usage_stats.last_user_update desc

#1


0  

You can find this info at modify_date column of sys.objects table

您可以在sys.objects表的modify_date列中找到此信息

SELECT name, modify_date from sys.objects where type ='U' order by modify_date desc

#2


0  

As your Question, you are looking for Table Change Effect :

作为您的问题,您正在寻找表变更效果:

SELECT name [TableName],
       Create_date [CreateDate],
       modify_date [LastUpdate]
FROM sys.all_objects
WHERE type = 'U'
ORDER BY modify_date DESC;

From above SQL Command which would give you all Table_Name which are last effected by some activities (i.e. insert, update or delete).

从上面的SQL命令,它将为您提供最后受某些活动影响的所有Table_Name(即插入,更新或删除)。

Result :

如何在数据库中找到最后修改

#3


0  

@sarslash and @Yogesh in my case your code show very old result. I found below code on somewhere and it work perfectly.

在我的情况下,@ sarslash和@Yogesh你的代码显示非常古老的结果。我在某处找到了下面的代码,它完美地工作。

select
    object_name(object_id) as OBJ_NAME, *
from
    sys.dm_db_index_usage_stats
where
    database_id = db_id(db_name())
Order by
    dm_db_index_usage_stats.last_user_update desc