From the course: Complete Guide to Advanced SQL Server

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

View all triggers in a database

View all triggers in a database

Triggers execute silently and often with no visible indication that they fired. So it's hard to tell when a command has been intercepted by a trigger. Because of this, it's important to keep track of what triggers are in the database and know what they're doing. SQL Server provides two catalog views that we can use to see what triggers are present in our databases. The first one I want to take a look at is sys.triggers. I'm going to run line number one here that just says "SELECT * FROM sys.triggers" to see what it contains. Now, your results might look a little different from mine, depending on whether you've actually gone through and created all of the different triggers throughout this course, and whether you've gone through and deleted them as well. But these are the results that I'm currently seeing inside of my KinetEcoTRG database. The first couple of columns just give me the name of the trigger, as well as this internal object ID number. Then we have a couple of columns that…

Contents