|
|
8000XXXX Errors ASP.NET 2.0 Classic ASP 1.0 Databases Access DB & ADO General SQL Server & Access Articles MySQL Other Articles Schema Tutorials Sql Server 2000 Sql Server 2005 General Concepts Search Engine Optimization (SEO)Search | ASP FAQ Tutorials :: Databases :: Schema Tutorials :: Schema: How do I show all the triggers in a database? Schema: How do I show all the triggers in a database?The following code uses a pair of nested recordsets to grab the triggers from the sysobjects table and then display them using sp_helptext (tested in SQL Server 2000):
Note that you must loop through the sp_helptext resultset because, as with stored procedures, each line of code in a trigger is returned as one row in the resultset. Are there other ways to do this? Sure, here's some sample code, but it should be avoided due to its reliance on an undocumented SP (as well as the fact that it produces a resultset for every table, regardless of whether it has a trigger):
And this code, adapted from a post by Alejandro Mesa - which includes more information, but not the text for each trigger in the current DB:
Related Articles Schema: How do I list all the indexes in a database? Schema: How do I list the databases on my server? Schema: How do I show all the primary keys in a database? Schema: How do I show the columns for a table? Schema: How do I show the description property of a column? Schema: How do I show the parameters for a function or stored procedure? Schema: How do I show the stored procedures in a database? Schema: How do I show the tables in a database? Schema: How do I show the user-defined functions (UDFs) in a database? Schema: How do I show the views in a SQL Server database? |