SELECT table_name = OBJECT_NAME(parent_object_id) ,
trigger_name = name ,
trigger_owner = USER_NAME(schema_id) ,
OBJECTPROPERTY(object_id, 'ExecIsUpdateTrigger') AS isupdate ,
OBJECTPROPERTY(object_id, 'ExecIsDeleteTrigger') AS isdelete ,
OBJECTPROPERTY(object_id, 'ExecIsInsertTrigger') AS isinsert ,
OBJECTPROPERTY(object_id, 'ExecIsAfterTrigger') AS isafter ,
OBJECTPROPERTY(object_id, 'ExecIsInsteadOfTrigger') AS isinsteadof ,
CASE OBJECTPROPERTY(object_id, 'ExecIsTriggerDisabled')
WHEN 1 THEN 'Disabled'
END AS status
WHERE type = 'TR'
ORDER BY OBJECT_NAME(parent_object_id)
This works great – very handy to have when you need to see what triggers are on what tables in your database!
PS – I used the
sample codetag in the HTML view to ‘force’ the single quotes to behave correctly in the code snippet above. Thank you to HTML Goodies for a great article on this!
PSS – I should also add that I great information with these 2 articles regarding triggers – UBER-helpful!!
Nigel Rivett – Triggers (Triggers 1, Triggers 2, Generate Trigger, Triggers, Audit trail trigger, Columns_updated(), View audit field changes)