In Microsoft SQL Server 2008, DDL trigger and DML trigger are found in two different places. They are shown in the following two images.
The following MSSQL script will list all the triggers you created in your database tables along with some other useful pieces of info like, isupdate
, isdelete
, isinsert
, isafter
, isinsteadof
, status showing if they are enabled or disabled.
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' ELSE 'Enabled' END AS status FROM sys.objects WHERE type = 'TR' ORDER BY OBJECT_NAME(parent_object_id)
Leave Your Comment