Is there a query which lists all the triggers created for any event on a particular table.
Say I have a table named client
, and I want to list all the triggers creared for any event(say insert/update/delete etc) on that table.
Any kind of help is appreciated
select * from INFORMATION_SCHEMA. TRIGGERS where EVENT_OBJECT_TABLE='client';
To test whether a row exists in a MySQL table or not, use exists condition. The exists condition can be used with subquery. It returns true when row exists in the table, otherwise false is returned. True is represented in the form of 1 and false is represented as 0.
To view database level triggers, Login to the server using SQL Server management studio and navigate to the database. Expand the database and navigate to Programmability -> Database Triggers. To view triggers at the server level, Login to Server using SSMS and navigate to Server Objects and then Triggers folder.
The accepted answer is correct and the most straightforward method, but for an enhanced view of the triggers on a table and more control over what is returned, use INFORMATION_SCHEMA:
select * from INFORMATION_SCHEMA.TRIGGERS where EVENT_OBJECT_TABLE='client';
With this, you can filter on things like EVENT_OBJECT_TABLE
(table name), TRIGGER_SCHEMA
, EVENT_MANIPULATION
(insert, update, delete, etc), and a slew of other attributes.
As pointed out in the comments above, you'll need to have TRIGGER permissions for this method as well.
SHOW TRIGGERS
SHOW TRIGGERS LIKE '<tablename>'
e.g.
SHOW TRIGGERS LIKE 'client'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With