Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews Databases Programming Interviews:BtrieveClipperData ModelingData StructuresDatabase AdministrationDatabase Administrator (DBA)Database AnalystDatabase DeveloperDB DevelopmentEDI/Data Integration ExpertFirebirdHierarchicalIBM DB2InformixJava DatabaseMariaDBMicrosoft Access DeveloperMongoDBMS SQL ServerMySQL ProgrammingNetworkNoSQLObject RelationalPostgrePostgreSQLProgressRDBMSRelationalSQLSQL AdministratorSQL and PL/SQLSQL Notification ServicesSQL server 2008SSRSStored ProcedureSybaseTeradata
Copyright © 2018. All Rights Reserved
MS SQL Server Interview Question:
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
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.