15 Nov 2008

Getting list of modified objects in SQL Server

No Comments SQL Server, Uncategorized

Developers always want to have a list of modified tables or stored procedures while check-in the code or wrapping up the development at the end of the day. some usually keep this list in text file and they update this file every time they modify any table or stored procedure. Here are some handy SQL snippets which can provide you list of the tables, or stored procedure modified in specific duration.

-- tables modified today
SELECT [name],create_date,modify_date
FROM sys.objects
WHERE modify_date>DATEADD(day,-1,GETDATE())
AND type='U'
-- stored procedures modified today
SELECT [name],create_date,modify_date
FROM sys.objects
WHERE modify_date>DATEADD(day,-1,GETDATE())
AND type='P'

You can further modify above queries to get list with objects modified in last 7 days.

-- tables modified in last 7 days
SELECT [name],create_date,modify_date
FROM sys.objects
WHERE modify_date>DATEADD(day,-7,GETDATE())
AND type='U'
Tags:
written by Firoz Ansari
The author didn‘t add any Information to his profile yet.
No Responses to “Getting list of modified objects in SQL Server”

Leave a Reply

Spam protection by WP Captcha-Free