Sqlserver 查询最新修改过的表、过程和视图等(Sqlserver queries the latest modified tables, procedures and views)

–SELECT A.[type],A.type_desc FROM sys.objects A GROUP BY A.[type],A.type_desc

GO

DECLARE @bTime AS DATETIME

SET @bTime=’2021-11-23′

–存储过程

SELECT * FROM sys.objects A WHERE A.[type]=’P’ AND A.modify_date>=@bTime ORDER BY A.modify_date DESC

–表

SELECT * FROM sys.objects A WHERE (A.[type]=’S’ OR A.[type]=’IT’ OR A.[type]=’U’) AND A.modify_date>=@bTime ORDER BY A.modify_date DESC

–函数

SELECT * FROM sys.objects A WHERE (A.[type]=’FN’ OR A.[type]=’TF’) AND A.modify_date>=@bTime ORDER BY A.modify_date DESC

–视图

SELECT * FROM sys.objects A WHERE A.[type]=’V’ AND A.modify_date>=@bTime ORDER BY A.modify_date DESC

GO

————————

–SELECT A.[type],A.type_desc FROM sys.objects A GROUP BY A.[type],A.type_desc

GO

DECLARE @bTime AS DATETIME

SET @bTime=’2021-11-23′

–Stored procedure

SELECT * FROM sys.objects A WHERE A.[type]=’P’ AND A.modify_date>=@bTime ORDER BY A.modify_date DESC

–Watch

SELECT * FROM sys.objects A WHERE (A.[type]=’S’ OR A.[type]=’IT’ OR A.[type]=’U’) AND A.modify_date>=@bTime ORDER BY A.modify_date DESC

–Functions

SELECT * FROM sys.objects A WHERE (A.[type]=’FN’ OR A.[type]=’TF’) AND A.modify_date>=@bTime ORDER BY A.modify_date DESC

–View

SELECT * FROM sys.objects A WHERE A.[type]=’V’ AND A.modify_date>=@bTime ORDER BY A.modify_date DESC

GO