Thursday, October 27, 2011

How to find list of all the triggers in Database

To find a list of  all the triggers in the specific database , we  can use the following query:

SELECT S2.[name] tablename, S1.[name] triggername,
CASE WHEN S2.deltrig = S1.id THEN 'Delete'
WHEN S2.instrig = S1.id THEN 'Insert'
WHEN S2.updtrig = S1.id THEN 'Update'
END 'TriggerType' , 'S1',S1.*,'S2',S2.* FROM sysobjects S1 JOIN sysobjects S2
ON S1.parent_obj = S2.[id] WHERE S1.xtype='TR'




No comments:

Post a Comment

SSRS - How to Parameterizing the SQL Query

We need to create separated dataset to handle the pre defined list in that dataset we will use simple select statement to define the li...