Connecting Tech Pros Worldwide Forums | Help | Site Map

How to view triggers in SQL server

Ryan
Guest
 
Posts: n/a
#1: Jul 20 '05
Hello,

I am pretty much a newbie with SQL server. I have what is probably a
pretty stupid question. In SQL Enterprise manager, is there a way to
easily see all triggers, or, even better, all tables and there
associated triggers? I suppose at the least in a way similar to
viewing all saved functions or views.

Thanks,
Ryan

Michael Gray
Guest
 
Posts: n/a
#2: Jul 20 '05

re: How to view triggers in SQL server


On 30 Aug 2004 15:47:53 -0700, ryan.d.rembaum@kp.org (Ryan) wrote:
[color=blue]
>Hello,
>
>I am pretty much a newbie with SQL server. I have what is probably a
>pretty stupid question. In SQL Enterprise manager, is there a way to
>easily see all triggers, or, even better, all tables and there
>associated triggers? I suppose at the least in a way similar to
>viewing all saved functions or views.
>
>Thanks,
>Ryan[/color]

It's a bit cludgy, but in Enterprise Manager, on the database you are
looking at, select [generate SQL scripts].
Untick [Script All Objects]
Tick [All Tables]
Under the [Formatting Tab] untick everything.
Under the [Options] tab, tick [Script Triggers]
(.) Create one file
Then [OK]

This text file will then contain the scripts for creating every
trigger in the database.
I know that is not what you wanted, but you never know!
Simon Hayes
Guest
 
Posts: n/a
#3: Jul 20 '05

re: How to view triggers in SQL server


ryan.d.rembaum@kp.org (Ryan) wrote in message news:<b5cda00e.0408301447.279701bb@posting.google. com>...[color=blue]
> Hello,
>
> I am pretty much a newbie with SQL server. I have what is probably a
> pretty stupid question. In SQL Enterprise manager, is there a way to
> easily see all triggers, or, even better, all tables and there
> associated triggers? I suppose at the least in a way similar to
> viewing all saved functions or views.
>
> Thanks,
> Ryan[/color]

Probably the easiest way is to use a query in Query Analyzer:

select name as 'Trigger', object_name(parent_obj) as 'Table'
from sysobjects
where xtype = 'TR'

sp_helptrigger will give you the details of an individual trigger, but
you need to know the table name first.

Simon
Chinni
Guest
 
Posts: n/a
#4: Jul 20 '05

re: How to view triggers in SQL server


sql@hayes.ch (Simon Hayes) wrote in message news:<60cd0137.0408310026.6c3a63c3@posting.google. com>...[color=blue]
> ryan.d.rembaum@kp.org (Ryan) wrote in message news:<b5cda00e.0408301447.279701bb@posting.google. com>...[color=green]
> > Hello,
> >
> > I am pretty much a newbie with SQL server. I have what is probably a
> > pretty stupid question. In SQL Enterprise manager, is there a way to
> > easily see all triggers, or, even better, all tables and there
> > associated triggers? I suppose at the least in a way similar to
> > viewing all saved functions or views.
> >
> > Thanks,
> > Ryan[/color]
>
> Probably the easiest way is to use a query in Query Analyzer:
>
> select name as 'Trigger', object_name(parent_obj) as 'Table'
> from sysobjects
> where xtype = 'TR'
>
> sp_helptrigger will give you the details of an individual trigger, but
> you need to know the table name first.
>
> Simon[/color]

YOu can run sp_helptext 'Triggername' to display the text of triger, sp function.

Raju
Ryan
Guest
 
Posts: n/a
#5: Jul 20 '05

re: How to view triggers in SQL server


Thank you everyone for you help. I am able to view individual
triggers using the method you suggested Simon/Raju. I would like to
use the scripting wizard that was recommended by you Chinni, as this
would give me a list of all the trigger definitions at once, but when
I generate the script per the instructions provided I only ger an
empty file. I know there are triggers set. Any idea as to why this
might be. We are running SQL 2000 if that helps.

Thanks,
Ryan

angani@gmail.com (Chinni) wrote in message news:<6dc75d33.0408311543.61b3514@posting.google.c om>...[color=blue]
> sql@hayes.ch (Simon Hayes) wrote in message news:<60cd0137.0408310026.6c3a63c3@posting.google. com>...[color=green]
> > ryan.d.rembaum@kp.org (Ryan) wrote in message news:<b5cda00e.0408301447.279701bb@posting.google. com>...[color=darkred]
> > > Hello,
> > >
> > > I am pretty much a newbie with SQL server. I have what is probably a
> > > pretty stupid question. In SQL Enterprise manager, is there a way to
> > > easily see all triggers, or, even better, all tables and there
> > > associated triggers? I suppose at the least in a way similar to
> > > viewing all saved functions or views.
> > >
> > > Thanks,
> > > Ryan[/color]
> >
> > Probably the easiest way is to use a query in Query Analyzer:
> >
> > select name as 'Trigger', object_name(parent_obj) as 'Table'
> > from sysobjects
> > where xtype = 'TR'
> >
> > sp_helptrigger will give you the details of an individual trigger, but
> > you need to know the table name first.
> >
> > Simon[/color]
>
> YOu can run sp_helptext 'Triggername' to display the text of triger, sp function.
>
> Raju[/color]
Closed Thread