Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Best way to review existing triggers 5

Status
Not open for further replies.

jojo11

Programmer
Feb 2, 2003
189
US
What is the best way to go through an exisiting database and review the triggers that are currently in place. I can create them but finding them is another matter...

-------------------------------------------
Ummm, we have a bit of a problem here....
 
the only way i've found so far is (in enterprise manager) to right-click on the table name & choose All Tasks --> Manage Triggers. I tried dropping them via Query Analyzer & it said it had never heard of them, but they were sitting in that view. Anyone have any idea why?

tigerjade :)





"Always code as if the person who ends up maintaining your code will be a violent psychopath who knows where you live." -- Martin Golding


 
select id, colID, text FROM syscomments where id in (select id from sysobjects where xtype = 'TR') order by id, colID

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

zen.gif
 
Sorry, don't want to take anything away from mwolf00, however if you do the following you get the table name and the triggers on it....

SELECT par.Name AS 'Table', trig.Name AS 'Trigger Name'
FROM sysObjects trig
JOIN sysObjects par
ON par.ID = trig.parent_obj
WHERE trig.xtype = 'TR'


If that isn't what you want, go to Enterprise Manager, choose to script all the tables and from the options tab click "Script Triggers". Then once it's done copy it into Notepad and bob's your uncle.

Hope all that helps.

Sam
 
both very helpful. Exactly what I needed....

-------------------------------------------
Ummm, we have a bit of a problem here....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top