# Database Discussions > MS SQL Server 7/MS SQL Server 2000 >  Where can I find all the triggers in my database

## Ali Alhussein

Hello, I have created a couple of triggers in many different tables. is there a way to run a comman in sql window to see a list of all the triggers that I created, or telling me which tables that triggers are located.

Thanks

Ali

----------


## axel

Hi,

In sysobjects you can find most of all objects 
So if youwant o see for example the triggers on the statstables table try this query !!!

select otabl.name , otr.name 
from sysobjects as otabl
inner join sysobjects as otr on otabl.id = otr.parent_obj
where otr.type = &#39;tr&#39; and otabl.name = &#39;statstables&#39;

I think it can help you

Best regards

Axel
------------
Ali Alhussein at 3/21/01 9:20:21 AM


Hello, I have created a couple of triggers in many different tables. is there a way to run a comman in sql window to see a list of all the triggers that I created, or telling me which tables that triggers are located.

Thanks

Ali

----------


## Larry

Ali, there&#39;s a couple of ways (that I know) to do this:

1) Query the system tables (not recommended by M$ though) like this:

   select so.name, so2.name as [table]
   from sysobjects so
   join sysobjects so2 on so.parent_obj = so2.id
   and so.xtype = &#39;tr&#39;

2) Execute &#39;sp_helptrigger&#39; for each table in the current database:

   sp_msforeachtable &#34;print &#39;?&#39; exec sp_helptrigger &#39;?&#39;&#34;

Hope this helps.

- Larry

------------
Ali Alhussein at 3/21/01 9:20:21 AM


Hello, I have created a couple of triggers in many different tables. is there a way to run a comman in sql window to see a list of all the triggers that I created, or telling me which tables that triggers are located.

Thanks

Ali

----------


## Ali Alhussein

Thanks for your 

------------
axel at 3/21/01 10:59:38 AM

Hi,

In sysobjects you can find most of all objects 
So if youwant o see for example the triggers on the statstables table try this query !!!

select otabl.name , otr.name 
from sysobjects as otabl
inner join sysobjects as otr on otabl.id = otr.parent_obj
where otr.type = &#39;tr&#39; and otabl.name = &#39;statstables&#39;

I think it can help you

Best regards

Axel
------------
Ali Alhussein at 3/21/01 9:20:21 AM


Hello, I have created a couple of triggers in many different tables. is there a way to run a comman in sql window to see a list of all the triggers that I created, or telling me which tables that triggers are located.

Thanks

Ali

----------


## Jonathan Yang

It works!  But sp_msforeachtable is not documented in SQL 2000 OL book.

Larry how do you know this?


------------
Larry at 3/21/01 11:00:41 AM

Ali, there&#39;s a couple of ways (that I know) to do this:

1) Query the system tables (not recommended by M$ though) like this:

   select so.name, so2.name as [table]
   from sysobjects so
   join sysobjects so2 on so.parent_obj = so2.id
   and so.xtype = &#39;tr&#39;

2) Execute &#39;sp_helptrigger&#39; for each table in the current database:

   sp_msforeachtable &#34;print &#39;?&#39; exec sp_helptrigger &#39;?&#39;&#34;

Hope this helps.

- Larry

------------
Ali Alhussein at 3/21/01 9:20:21 AM


Hello, I have created a couple of triggers in many different tables. is there a way to run a comman in sql window to see a list of all the triggers that I created, or telling me which tables that triggers are located.

Thanks

Ali

----------

