How To List All Triggers in the Database with sys.triggers in MS SQL Server?
Submitted by: AdministratorIf you want to list all triggers defined in the current database, you can use the catalog view, sys.triggers, as shown in the following tutorial example:
USE GlobalGuideLineDatabase;
GO
CREATE TRIGGER new_user ON ggl_users
AFTER INSERT
AS
PRINT 'New users added.';
GO
SELECT * FROM sys.triggers
GO
<pre>name object_id parent_id type type_desc
------------ ----------- ----------- ---- ------------
dml_message 690101499 674101442 TR SQL_TRIGGER
new_user 706101556 674101442 TR SQL_TRIGGER </pre>
The result shows that there are 2 triggers defined in GlobalGuideLineDatabase.
Submitted by: Administrator
USE GlobalGuideLineDatabase;
GO
CREATE TRIGGER new_user ON ggl_users
AFTER INSERT
AS
PRINT 'New users added.';
GO
SELECT * FROM sys.triggers
GO
<pre>name object_id parent_id type type_desc
------------ ----------- ----------- ---- ------------
dml_message 690101499 674101442 TR SQL_TRIGGER
new_user 706101556 674101442 TR SQL_TRIGGER </pre>
The result shows that there are 2 triggers defined in GlobalGuideLineDatabase.
Submitted by: Administrator
Read Online MS SQL Server Job Interview Questions And Answers
Top MS SQL Server Questions
☺ | How To Execute the Cursor Queries with "OPEN" Statements? |
☺ | What Happens If Strings Are Casted into Wrong Code Pages in MS SQL Server? |
☺ | PHP MSSQL - How To Display a Past Time in Days, Hours and Minutes? |
☺ | How To Create a View on an Existing Table in MS SQL Server? |
☺ | How To Create a Large Table with Random Data for Index Testing in MS SQL Server? |
Top Databases Programming Categories
☺ | RDBMS Interview Questions. |
☺ | SQL Interview Questions. |
☺ | SSRS Interview Questions. |
☺ | Database Administrator (DBA) Interview Questions. |
☺ | Sybase Interview Questions. |