How to View Triggers in SQL Server Management Studio
SQL Server has many types of triggers that can be created, but finding them using SQL Server Management Studio (SSMS) may not be easy if you are not sure where to look. In this tip we look at how to use SSMS to find and manage both DML triggers and DDL triggers.
Solution
SQL Server Management Studio is a graphical interface that allows the user to configure, manage and also edit scripts. Although the GUI is easy to use, we must recognize that knowing where to find objects is not always that easy and this is true with triggers because there are different types of triggers and they are not all in the same place in SSMS.
Triggers in SQL Server Management Studio
There are two types of triggers that can be created:
- DML (Data Manipulation Language) triggers and
- DDL (Data Definition Language) triggers.
The DML triggers are those that fire when a SQL statement tries to change the data of a given table or view. These can be created on tables and views.
On the other hand, DDL triggers fire when a SQL statement tries to change the physical structure of the database (i.e. create, alter or delete database objects). Additionally, there are DDL triggers that fire when there are changes to server objects (i.e. create, alter or drop linked servers or databases).
In the next sections I will show you how to access to each type of trigger within SSMS.
Table Scoped SQL Server DML Triggers
If we need to see the triggers on a specific table, we can use SSMS in the following way. First expand Databases, then expand the database that contains the table. Next expand the Tables folder and find the table you are looking for then expand the table and expand Triggers to see a list of triggers for the table as shown below.

Now that we found the trigger, right click on the trigger to see a menu of things you can do from SSMS. If you click on Script Trigger as you can see the different scripts you can create from SSMS as shown below.

That context menu gives you the chance to modify, script, view dependencies, enable or disable and delete the trigger. The modify item opens a new script window in the SSMS editor with the trigger’s source code scripted as an ALTER TRIGGER statement.
View Scoped SQL Server DML Triggers
Additionally, SSMS can be used to look at triggers that are scoped to views. Follow the same steps as if you were looking at a table scoped trigger, but instead of expanding the Table folder expand the Views folder. The next screen capture shows those steps in order.

Also, if you right click on the trigger you will see a menu similar to the trigger scoped tables.

SQL Server Database Scoped DDL Triggers
If you want to view these triggers go to the Programmability folder within the database and look for a subfolder named Database Triggers as shown below.

You will notice on the next screen capture that if you right click on a database trigger the context menu is slightly different to the one of table and view scoped triggers. There isn’t a Modify item, but still we have the chance to script the trigger as DROP and CREATE statements. Also, like on the table and view scoped triggers, we have the options to view the trigger dependencies, enable or disable and delete the trigger.

Server Scoped SQL Server DDL Triggers
In case we want to see DDL triggers that affect the entire server we need to look at the Server Objects folder in the server tree view. You will see a child branch Triggers. Expand the Triggers folder to see a list of server scoped DDL triggers.

When we right click on the trigger name, we will see a menu with the same items as the database scoped triggers.

Next Steps
- This tip was written using SQL Server Management Studio v17.9. If you still using an older version of SSMS I suggest you read the following tip to see if it’s worth upgrading New Features in SQL Server Management Studio v17. Additionally take a look at this tip SQL Server Management Studio 17.x Important Features.
- If you don’t have SSMS installed take a look at this tip for a quick guide on How to Install SQL Server Management Studio on your Local Computer.
- If you know the trigger name you can use the object search feature of SSMS. You can learn more about this here Using Object Explorer Details and Object Search Feature of SSMS 2008.
- If you don’t know the trigger’s name you can use the scripts from this tip: Find All SQL Server Triggers to Quickly Enable or Disable.
- If you need to script triggers for any database you can take a look at the following tip Script triggers from any database in SQL Server.
- Stay tuned to the SQL Server Triggers tips category for more tips and tricks using triggers.
- For more tips related to SSMS you can browse the SQL Server Management Studio tips category.


About the author
Daniel Farina was born in Buenos Aires, Argentina. Self-educated, since childhood he showed a passion for learning.
блог кнопочкотыкателя
недавно столкнулся со следующей проблемкой:
надо получить список триггеров по определенной БД(зачем это было надо, наверное позже напишу).
в итоге делаем следующее
открываем новый запрос в SQL Server Management Studio.
Выбираем нужную БД, или указываем кодом, например: Use PayDox.
и вставляем код. я использовал вот такой
select so1.name,so.name ,sc.id, sc.text from syscomments sc, sysobjects so, sysobjects so1 where sc.id=so.id and so.name like ‘%TR%’ and so1.id=so.parent_obj
зы: код не оптимизировал.
на выходе получаем:
1) название таблицы, которую мониторит триггер
2) Название триггера
3) Его ИД
4) код триггера
зы: код триггера разбит на несколько записей. с чем связано не знаю, ибо если не знали какой текст будут вставлять в поле то указали бы например varchar(max)
зыы: полазив по sysobjects и syscommnets много интересного и полезного можно найти.
Как найти все триггеры, связанные с таблицей с SQL Server?
Я создал триггер для таблицы в SQL Server и у меня это работает.
Моя проблема: как его найти и изменить?
Я использую этот запрос, чтобы найти свои триггеры:
Это находит все триггеры, но как его открыть и изменить триггеры?
задан 10 сен ’12, 08:09

16 ответы
Вы можете сделать это просто с помощью SSMS. Просто перейдите к имени таблицы и разверните узел «Триггеры», чтобы просмотреть список триггеров, связанных с этой таблицей. Щелкните правой кнопкой мыши, чтобы изменить триггер. 
Таким образом, вы можете перечислить все триггеры, связанные с данной таблицей.
Создан 30 июля ’18, 14:07

Это потенциально может вернуть слишком много рядов случай, когда %YoutTableName% не просто представляет таблицу. Пример: Продукт -< ПродуктАкция >- Акция — Pfonseca
Это отличный ответ, потому что он должен работать во всех средах разработки. Мне нужно было найти триггер, который не отображался в папке триггеров моей базы данных в SSMS, подключенной к базе данных, размещенной в Azure. — Джейсон Д.
Это может быть полезно
Таким образом, вам просто нужно добавить имя таблицы, и запрос будет получать все необходимые вам триггеры.
Создан 08 июля ’15, 13:07
Здесь просто скопируйте определение и измените триггер.
В противном случае вы можете просто перейти к SSMS и развернуть свою БД, а в разделе «Программируемость» развернуть «Триггеры базы данных», затем щелкнуть правой кнопкой мыши конкретный триггер и щелкнуть «Изменить», также вы можете изменить.
используйте sp_helptrigger, чтобы найти список триггеров для связанных таблиц
найти триггеры в таблице:
и вы можете найти процедуру хранения, которая имеет ссылку на таблицу:
ответ дан 31 авг.

Этот URL имеет набор запросов, по которым вы можете получить список триггеров, связанных с конкретной таблицей.
Я полагаю, что вы работаете в sqlserver. Ниже приведены шаги для получения триггеров модификации.
Чтобы изменить триггер
Разверните группу серверов, а затем разверните сервер.
Разверните Базы данных, разверните базу данных, к которой принадлежит таблица, содержащая триггер, а затем щелкните Таблицы.
В области сведений щелкните правой кнопкой мыши таблицу, в которой существует триггер, выберите Все задачи, а затем щелкните Управление триггерами.
В поле «Имя» выберите имя триггера.
При необходимости измените текст триггера в поле Текст. Нажмите CTRL+TAB, чтобы сделать отступ в тексте триггера SQL Server Enterprise Manager.
How to Return a List of Trigger Events in SQL Server
You can use T-SQL to return a list of trigger events in a database in SQL Server.
You can do this using sys.trigger_events . This system catalog view returns a row for each event or event group on which a trigger can fire.
Example 1 – Basic Usage
Here’s an example to demonstrate.
In this case I’m using the OBJECT_NAME() function to get each trigger’s name from its object_id .
Example 2 – Narrow it to a Specific Trigger
You can also use OBJECT_NAME() to filter the results to a specific trigger name using a WHERE clause.
Example 3 – Return All Columns
This example returns all columns from this view.
Result (using vertical output):
In this example I presented the results using vertical output so that you aren’t forced scroll horizontally.