Retrieve Triggers from the SQL Command Prompt

Downloads
94862.zip

Neither Enterprise Manager nor SQL Server Management Studio (SSMS) lets you view a complete list of triggers for a given database. Instead, you have to expand the triggers portion of the tree for each table. Because I primarily work inside a query window, the more work I can do from the SQL command prompt, the better. So, I created the sp_ListTriggers stored procedure to list all the triggers in the current database. I wrote sp_ListTriggers, which you can download from the SQL Server Magazine Web site, for SQL server 2000.

To use sp_ListTriggers to list all the triggers in the current database, you execute the following command in Query Analyzer:

EXEC sp_ListTriggers

Optionally, you can use sp_ListTriggers to list only those triggers for a specific table. You simply pass in the name of the table using the command

EXEC sp_ListTriggers@Table='YourTableHere'

where YourTableHere is the name of your table. You can even include wildcards in the table's name.
—Bill McEvoy

Discuss this Article 1

Delfoe (not verified)
on Jun 12, 2007
This is a very helpful script. Especially for someone who needs to know all the tables with triggers in a database.

Please or Register to post comments.

IT/Dev Connections

Las Vegas
September 30th - October 4th

Paul ThurottOur Experts will show you:
• Common SQL Server
Problems
• Best Practices for T-SQL
• SQL Server Integration
Services
• Database Development

Come See Michael Otey & Tim Ford in Person!

Early Registration Now Open

From the Blogs
May 21, 2013
blog

A Common Misconception about MAXDOP

Out of the box, SQL Server is (and has been) able to take advantage of multiple processors/cores without any effort on behalf of administrators....More
May 9, 2013
blog

My ISO 8601-Compliant Signature 2

My family recently just "officially" announced that we're in the process of adopting a child from South Africa. We're quite excited, of course, but there's a ton of paperwork to do—along with the need for gobs of signatures....More
May 8, 2013
blog

Use SSIS for ETL from Hadoop

In this blog post, Mark Kromer walks you through using SSIS as a way to use ETL techniques using Microsoft's Hadoop on Windows (HDInsight) as a source using Hive connectors...More
SQL Server Pro Forums

Get answers to questions, share tips, and engage with the SQL Server community in our Forums.