I need to delete a trigger in SQL Server. Seems like it should be simple enough, but because there is a thing called a "delete trigger", a trigger that is invoked upon deletion, it seems impossible to find resources on how to actually delete an already existing trigger.
-
Just make sure you aren't dropping a trigger that is needed for data integrity. Dropping a trigger because it prevents you from doing something is often a clue that what you want to do is not a good idea. Never drop a trigger without consulting the dba. – HLGEM Dec 31 '10 at 18:55
5 Answers
Removes one or more triggers from the current database...
You can remove a trigger by dropping it or by dropping the trigger table. When a table is dropped, all associated triggers are also dropped. When a trigger is dropped, information about the trigger is removed from the sysobjects and syscomments system tables.
Use DROP TRIGGER and CREATE TRIGGER to rename a trigger. Use ALTER TRIGGER to change the definition of a trigger...
-
Works! ;) Heh, thanks! I'll mark is as the correct answer in 11 minutes, StackOverflow prevents me from accepting it immediately. – Teekin Dec 31 '10 at 17:25
-
3Fyi. In sql, delete is a row operation, drop is a db object (for example, a trigger) operation. – DwB Dec 31 '10 at 17:27
-
-
Remember to add the Schema prefix if it isn't dbo. So if the schema is 'MySchema' write DROP TRIGGER MySchema.SomeTrigger – Loke Apr 12 '18 at 16:12
To drop a trigger, this works:
DROP TRIGGER [trigger_name];
If you want to check weather trigger exist before a drop, then use:
SELECT * FROM [sys].[triggers] WHERE [name] = 'MyTrigger'
For more check out http://www.tsql.info/triggers/drop-trigger.php and https://stackoverflow.com/a/636470/2218697
For SQL Server 2016 and above
DROP TRIGGER IF EXISTS [dbo].[trg]
https://learn.microsoft.com/en-us/sql/t-sql/statements/drop-trigger-transact-sql

- 1,895
- 1
- 17
- 26
I can Drop a Trigger with the Following Query
DROP TRIGGER [Trigger_Name]
(OR)
DROP TRIGGER Trigger_Update
Hope this Must helpfull...

- 223
- 3
- 20