Tuesday, March 23, 2010

DDL Trigger on Database Create

I created a DDL trigger on SQL Server 2008 with SP1. Trigger is firing well for Create Database statement. However, it does not fire for the instance where you restore a database to a new database. Since, there is no DDL trigger event for Database Restore there are no other alternative.

To capture the database restore event, there was a nice suggestion by a forum member in SQL Server Central to create a DML trigger on [msdb].[dbo].[restorehistory]

1 comment:

  1. That won't work as the the user defined trigger won't be fired on some system tables.