Triggers

  • HI

    How can I list out all the triggers i have on a database instead of cheking each n every table.

  • Hi,

    You could list out those triggers from sysobjects table where xtype = 'TR'  

  • create table #test (trgname varchar(100), owner varchar(40),isupdate bit,isdelelete bit,isinsert bit,isafter bit, isinsteafof bit)

    exec sp_msforeachtable  'insert into #test exec sp_helptrigger ''?'''

    select * from #test

    go

    drop table #test

  • and here's another method that i use myself; i need to find all trigers and their trigger body if it exists:

    select parent_objects.name,  

      trigger_sysobjects.name,  

      syscomments.text  

      FROM sysobjects trigger_sysobjects  

      INNER JOIN sysobjects parent_objects on parent_objects.id=  trigger_sysobjects.parent_obj  

      INNER JOIN syscomments on trigger_sysobjects.id=syscomments.id  

      WHERE trigger_sysobjects.xtype='TR' 

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply