4>
5> SELECT t.name, m.Definition
6> FROM sys.triggers AS t
7> INNER JOIN sys.sql_modules m ON
8> t.object_id = m.object_id
9> WHERE t.parent_class_desc = 'DATABASE'
10> GO
name
Definition
------------------------------------------------------------------------------------------------------------------------
-------- ---------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
-------------------------
db_trg
CREATE TRIGGER db_trg
ON DATABASE
FOR CREATE_INDEX, ALTER_INDEX, DROP_INDEX
AS
SET NOCOUNT ON
INSERT dbo.MyAudit
(EventData, DBUser)
VALUES (EVENTDATA(), USER)
|