Getting list of modified objects in SQL Server

November 15, 2008 — Leave a comment

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'

No Comments

Be the first to start the conversation!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s