I am using SQL Advantage and need to know what the SQL is to identify the triggers associated with a table. I don't have the option to use another tool so the good old fashioned SQL solution is the ideal answer.
views:
1355answers:
3Thanks Ray, I searched for along time yesterday but never found that article. It has a bounty of useful information in there.
Bill Rawlinson
2008-11-26 18:06:34
I would have just added my answer clarification to yours but I can't edit an answer. I think because I didn't have community wiki checked when I created the question.
Bill Rawlinson
2008-11-26 18:11:46
+2
A:
I also found out that
sp_depends <object_name>
will show you a lot of information about a table, including all triggers associated with it. Using that, along with Ray's query can make it much easier to find the triggers. Combined with this query from Ray's linked article:
sp_helptext <trigger_name>
and you can see the definition of the trigger:
sp_depends <trigger_name>
will also show you all tables related to a trigger
Bill Rawlinson
2008-11-26 18:10:55
A:
I believe there is (or at least 'was') some issue where dependency information is not always accurate. Therefore I would attempt to approach it like this :
select name
from sysobjects
where xtype='TR'
and id in (select id from syscomments where text like '%MY-TABLE-NAME%')
Good luck.
PS-This is untested code, leave a comment if it doesn't work, and I'll fix it.
John MacIntyre
2008-11-29 07:14:26