Wednesday | January 30, 2008

Easy way to identify all Triggers in a DB

Just Execute the query below and you will get the list of all the triggers in the selected Database

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'

Posted by Mohit at 11:04:02 | Permanent Link | Comments (0) |
Comments
Write a comment