Bilal Rafique
Bilal Rafique

Reputation: 294

Dropping a DDL Trigger gives error

I created a simple trigger using the below code

Create Trigger preventDrop on Database for Drop_Table   
AS
    Print 'You cannot Drop a Table'
    RollBack;
Go

And It works Ok. It does not let me drop a Table. But Now When I drop this trigger using

drop Trigger preventDrop

It does not let me drop the trigger and gives the following error

Msg 3701, Level 11, State 5, Line 10
Cannot drop the trigger 'preventDrop', because it does not exist or you do not have permission.

What could be the problem?

Upvotes: 5

Views: 4421

Answers (1)

LDMJoe
LDMJoe

Reputation: 1589

Dropping DDL Triggers requires the syntax:

DROP TRIGGER preventDrop ON DATABASE;

Source: MSDN

Upvotes: 11

Related Questions