Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server: check whether a Trigger is Enabled or Disabled?

How we can see which Trigger is Enabled or Disabled in SQL Server 2008?

like image 646
Vikrant More Avatar asked Nov 15 '11 13:11

Vikrant More


People also ask

How can check trigger status in SQL?

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.

Where can I find disabled triggers in SQL Server?

You can use the is_disabled column in sys. triggers table to filter the records according to your requirement.

What statement is used to be enabled or disabled triggers?

To enable a trigger, causes it to fire when any Transact-SQL statements on which it was originally programmed are run. Triggers are disabled by using DISABLE TRIGGER. DML triggers defined on tables can also be disabled or enabled by using ALTER TABLE.


2 Answers

Using sys.triggers

SELECT name, is_disabled FROM sys.triggers 
like image 149
gbn Avatar answered Sep 19 '22 10:09

gbn


In big databases you usually don't know the table for the trigger.

SELECT OBJECT_NAME(parent_id) [table_name],[name] [trigger_name],is_disabled
FROM sys.triggers 
like image 37
Igor Micev Avatar answered Sep 23 '22 10:09

Igor Micev