DDL trigger for ALTER_DATABASE is not working

  • Hi All,

    Sorry if the topic already exists. I have a DDL trigger for Alter_Database and Drop_Database on all server. The trigger fires for Drop_Database, but is not fired for alter_Database.

    Can anybody help me out in this issue or Is there any other alternative for handling this DDL event(ALTER_DATABASE) ?

    Any help, greatly appreciated.

    Thanks in Advance.

    Regards
    Priya

  • you'll need to paste the trigger in question, so we can see what the issue is.

    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!

  • Thanks for ur reply.

    Create trigger tr_Prevent_DDL On All Server For Alter_Database, Drop_Database

    As

    begin

    Print 'Restricted';

    Rollback;

    End

    Go

    This trigger fires for both the defined events. But It restricts the DROP_DATABASE but not the ALTER_DATABASE.

    The message is printed if we alter the database but the changes made to the database is applied to it.

    Is there any way we can prevent changes to the database with the DDL Trigger?

    Regards
    Priya

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

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