Search

Thursday, July 28, 2011

Code to list changes of tables, views, indexes etc in the last x days

Code to list changes of tables, views, indexes etc in the last x days
Change the number 20 to the days back in time you whant to check.

Works with sql server 2005 only
SELECT name AS object_name
,SCHEMA_NAME(schema_id) AS schema_name
,type_desc
,create_date
,modify_date
FROM sys.objects
WHERE modify_date > GETDATE() - 20
ORDER BY modify_date;

For sql server 2000:
SELECT name AS object_name

,type
,crdate as Create_date
,refdate as ChangeDate
FROM sysobjects
WHERE refdate > GETDATE() - 20
ORDER BY ChangeDate;

No comments:

Post a Comment