December 11, 2009

Retrieve a Report of all Schema Changes within a SQL Server 2008 Database

Some of the most obvious things are often overlooked!

During one of my discussions with a client, I was asked for a simple way to detect all schema changes (DDL Operations) in the SQL Server database and to generate a report out of it. These people were interested in only the DDL operation performed and who performed it. To detect changes, they were planning to create a trigger, detect changes and then write it to a log file.

I advised them to use the Database Standard Reports which does the job for us

Open SSMS 2008 > Right Click a Database > Report > Standard Reports > Schema Changes History

image

The report displays you a history of all committed DDL statement executions within the Database

image


About The Author

Suprotim Agarwal, ASP.NET Architecture MVP works as an Architect Consultant and provides consultancy on how to design and develop Web applications.

Suprotim is also the founder and primary contributor to DevCurry, DotNetCurry and SQLServerCurry. He has also written an EBook 51 Recipes using jQuery with ASP.NET Controls.

Follow him on twitter @suprotimagarwal

2 comments:

Anonymous said...

What privileges are required to generate this report? Can a user with DBO on that database generate the report? We are seeing an 'you do not have permission to run sys.traces' error. The sysadmin can run the report.

Suprotim Agarwal said...

Most of these reports are internally calling a DMV. Check the 'Required Permission' section in this link over here Querying Dynamic Management Views. So you can run the profiler to check the DMV's being called and grant the SELECT permission to the user on that DMV.