Search

Monday, November 2, 2015

List database objects modified in the last ‘X’ days

Use below query to get the list of databases modified in last 'X' days:

USE <database_Name>; 
GO 
SELECT Name AS object_Name,  
  Create_Date, Modify_Date, 
  Type_Desc,
  SCHEMA_Name(Schema_ID) AS Schema_Name 
FROM sys.Objects 
WHERE Modify_Date > GETDate() - <X_Days> 
ORDER BY Modify_Date; 
GO 

Notes: Replace <database_Name> with Database Name and <X_Days>  with No of days.