SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Development resources, articles, tutorials, code samples, tools and downloads for ASP.Net, SQL Server, Reporting Services, T-SQL, Windows, AWS, SAP HANA and ABAP


List of SQL Server Triggers created on Database Tables

SQL Server database administrators and T-SQL developers can query sys.triggers system catalog view for database table triggers and table names. This SQL tutorial shares the source codes of a SQL query that list all triggers created on database tables with the table names that they are created on.

SQL Server database administrator or T-SQL programmer can query sys.triggers system catalog to see the full list of SQL triggers created on that SQL database.

select * from sys.triggers
Code

sys.triggers catalog view to list all triggers created on that database
SQL Server sys.triggers catalog view to list all triggers created on that database

Let's modify the above SQL Select statement and add additional field for table name and remove unnecessary columns to simplfy the query.

select
 name 'Trigger Name',
 OBJECT_NAME(parent_id) 'Table Name'
from sys.triggers
where OBJECTPROPERTY(parent_id,'IsUserTable') = 1
Code

all triggers and corresponding table names
All triggers and corresponding table names on a SQL Server database

You can add additional WHERE clause criteria list to filter for a specific database table name to return the list of triggers created on that specific sql table.

select
 name 'Trigger Name',
 OBJECT_NAME(parent_id) 'Table Name'
from sys.triggers
where OBJECTPROPERTY(parent_id,'IsUserTable') = 1
 and OBJECT_NAME(parent_id) = 'Person'
Code


SQL Server

SQL Server 2019 Installation
download SQL Server 2019
download SQL Server 2017
download SQL Server 2016
download SQL Server 2014
download SQL Server 2012
MacOS ve SQL Server 2019


Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.