Where would you like to go, Toady? RSS 2.0
# Wednesday, July 21, 2010
When you open a SQL Server database that has Triggers, it is not at all obvious how you might find them and enumerate their contents. The following SQL code will show you all the triggers in your database including which table they are associated with.
SELECT name AS 'Trigger Name', OBJECT_NAME(parent_obj) AS 'Table'
FROM sysobjects
WHERE xtype = 'TR'

The results will be in this format.

Trigger result

 

From here, you can enumerate their contents like this

sp_helptext TriggerName

You can also view all the triggers associated with a particular table with this code.

sp_helptrigger TableName
Wednesday, July 21, 2010 1:21:25 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] -
Bookmark, Tweet, or Share

Stackoverflow.com Rep
Flickr stream
Archive
<July 2010>
SunMonTueWedThuFriSat
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2010
Chris Ballance
Sign In
Statistics
Total Posts: 46
This Year: 12
This Month: 0
This Week: 0
Comments: 11
All Content © 2010, Chris Ballance

Valid XHTML 1.0 Transitional