SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE TRIGGER [DDL_Catcher] ON DATABASE
FOR
      CREATE_TABLE,     ALTER_TABLE,      DROP_TABLE,
      CREATE_PROCEDURE, ALTER_PROCEDURE,  DROP_PROCEDURE,
      CREATE_FUNCTION,  ALTER_FUNCTION,   DROP_FUNCTION,
      CREATE_TRIGGER,   ALTER_TRIGGER,    DROP_TRIGGER,
      CREATE_VIEW,      ALTER_VIEW,       DROP_VIEW,
      ALTER_SCHEMA,     RENAME
      /*
            RENAME is new in SQL Server 2008.  If you
            try this in SQL Server 2005, you will get:           

            Msg 1084, Level 15, State 1, Procedure DDL_Catcher, Line 8
            'RENAME' is an invalid event type.
      */
AS
BEGIN
      SET NOCOUNT ON;
return

      -- you can log this somewhere for later review, or you
      -- can just comment it out:

      SELECT N'Fired for ', EVENTDATA().value
      (
            '(/EVENT_INSTANCE/TSQLCommand/CommandText)[1]',
            'NVARCHAR(MAX)'
      );     

      EXEC dbo.p_sys_RefreshSysDepends;
END

GO
