DDL Triggers - How to verify they are enabled

  • We are looking at implementing DDL triggers to capture schema changes, database security and server level security.

    I understand that these triggers are enabled when they are created and when SQL is started.

    How can I be sure that the triggers stay enabled all the time?

    Is there a way to get notified if a trigger is disabled?

    How would I set this up?

    Thanks.

  • the key you are looking for is sys.triggers; i think you'd have to schedule a job to email if the condiftion of is_disabled = 1 is ever found.

    here's an example

    name object_id parent_class parent_class_desc parent_id type type_desc create_date modify_date is_ms_shipped is_disabled is_not_for_replication is_instead_of_trigger

    ReturnPREventData 117575457 0 DATABASE 0 TR SQL_TRIGGER 2009-11-09 13:41:02.970 2009-11-09 13:41:02.970 0 0 0 0

    TR_mytest 1093578934 1 OBJECT_OR_COLUMN 805577908 TR SQL_TRIGGER 2010-02-01 11:30:30.970 2010-02-01 11:30:30.970 0 0 0 1

    CreateIndex_Prevent 1205579333 0 DATABASE 0 TR SQL_TRIGGER 2010-03-15 11:37:30.327 2010-03-15 11:37:30.327 0 0 0 0

    and here's some code to query it:

    select * from sys.triggers

    where parent_class_desc='DATABASE' -- OR parent_id = 0 --database trigger

    and is_disabled = 1

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply