I have two SQL Server instances that I manage. One is a SQL Server 2000 instance, and the other is 2005.
Some where, on these servers, I recall setting up a couple table triggers that were executed under certain conditions. I need to look-up these triggers as a point of reference for a new project, however, for the life of me I can not find them.
Is there some crafty SQL statement that I can execute that can iterate over all my databases and, subsequently, iterate over each table and output any triggers associated with the tables?
Best Answer
This will give you a list of tables that have triggers, and the name of the associated trigger:
This will give you the same list, with a column that shows the actual text of the trigger statement:
As Aaron suggested, this would work for SQL Server 2005+ as well:
And per his excellent suggestion, the following works for SQL Server 2000+ (including SQL Server 2012):