Monday, 4 January 2016

How to identify modified objects by using SQL Script

When working on quality assurance, staging and production environments, it is very important to have control over the changes made to the database definition – objects and design.This is a simple script to help you get a list of objects in your database with their creation and modification dates.

USE RajendraDB
GO
SELECT  so.name AS ObjectName,
OBJECT_NAME(so.parent_object_id) AS ParentObjectName,
SCHEMA_NAME(so.schema_id) AS SchemaName,
so.type_desc AS ObjectType,
so.create_date AS ObjectCreationDateTime,
so.modify_date AS ObjectModificationDateTime,
so.is_published AS IsPublished
FROM    sys.objects AS so
WHERE   so.is_ms_shipped = 0
ORDER BY CASE WHEN so.parent_object_id = 0 THEN so.object_id
ELSE so.parent_object_id
END,
so.schema_id,
so.type DESC,
so.modify_date DESC,
so.create_date DESC ;
GO

No comments:

Post a Comment