Computer and Internet » Server » MySQL » Triggers

ID #1008

How can I check to see whether a trigger exists and if it exists then delete it ?

this isn't working

DROP TRIGGER IF EXISTS `trigger_name`

DROP TRIGGER cannot be used together with the handy MYSQL extension "IF EXISTS". Other 5.0 features, like PROCEDUREs and FUNCTIONs however, do have this feature.

If you want to test for the existence of a trigger before removing it, you can do the following test before you delete it:

SELECT COUNT(*) FROM information_schema.TRIGGERS where TRIGGER_NAME = {yourtriggerhere};

Tags: -

Related entries:

Last update: 2006-10-20 19:12
Author: Christian Trummer
Revision: 1.1

Digg it! Print this record Send to a friend Show this as PDF file
Propose a translation for Propose a translation for
Please rate this entry:

Average rating: 0 out of 5 (0 Votes )

completely useless 1 2 3 4 5 most valuable

You cannot comment on this entry