Home All Groups Group Topic Archive Search About

How to list all Triggers with SQL 2005 like sp_tables or sp_databases?

Author
23 Mar 2006 9:16 AM
Andreas Klemt
Hello,

how can I list all Triggers like sp_tables or sp_databases?

Thanks for any help in advance!

Regards,

Andreas Klemt

Author
23 Mar 2006 9:25 AM
Jens
Hi,

fromthe procedure text of sp_helptrigger:


    select
    trigger_name = name,
    trigger_owner = user_name(uid),
    isupdate = ObjectProperty( id, 'ExecIsUpdateTrigger'),
    isdelete = ObjectProperty( id, 'ExecIsDeleteTrigger'),
    isinsert = ObjectProperty( id, 'ExecIsInsertTrigger'),
    isafter = ObjectProperty( id, 'ExecIsAfterTrigger'),
    isinsteadof = ObjectProperty( id, 'ExecIsInsteadOfTrigger')
    from sysobjects
    where type = 'TR'

HTH, Jens Suessmeyer.

---
http://www.sqlserver2005.de
---
Author
23 Mar 2006 9:31 AM
Andreas Klemt
Hello Jens,

thank you very much!

Is there a way with a stored proc to list all the trigger codes at once?

Kind Regards
Andreas Klemt

Show quote
"Jens" <J***@sqlserver2005.de> schrieb im Newsbeitrag
news:1143105929.558246.57750@i39g2000cwa.googlegroups.com...
> Hi,
>
> fromthe procedure text of sp_helptrigger:
>
>
> select
> trigger_name = name,
> trigger_owner = user_name(uid),
> isupdate = ObjectProperty( id, 'ExecIsUpdateTrigger'),
> isdelete = ObjectProperty( id, 'ExecIsDeleteTrigger'),
> isinsert = ObjectProperty( id, 'ExecIsInsertTrigger'),
> isafter = ObjectProperty( id, 'ExecIsAfterTrigger'),
> isinsteadof = ObjectProperty( id, 'ExecIsInsteadOfTrigger')
> from sysobjects
> where type = 'TR'
>
> HTH, Jens Suessmeyer.
>
> ---
> http://www.sqlserver2005.de
> ---
>
Author
23 Mar 2006 11:12 AM
Aaron Bertrand [SQL Server MVP]
Add Object_Definition(id) to the select list.


Show quote
"Andreas Klemt" <aklem***@hotmail.com> wrote in message
news:OspiUylTGHA.5172@TK2MSFTNGP12.phx.gbl...
> Hello Jens,
>
> thank you very much!
>
> Is there a way with a stored proc to list all the trigger codes at once?
Author
23 Mar 2006 2:31 PM
Andreas Klemt
Hello Aaron,

thank you!

Is there a way to put a code in the stored proc that the results are shown
as "Results to Text"
instead of "Results to grid" ?

Kind Regards
Andreas Klemt

Show quote
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@dnartreb.noraa> schrieb im
Newsbeitrag news:uov9xomTGHA.4436@TK2MSFTNGP10.phx.gbl...
> Add Object_Definition(id) to the select list.
>
>
> "Andreas Klemt" <aklem***@hotmail.com> wrote in message
> news:OspiUylTGHA.5172@TK2MSFTNGP12.phx.gbl...
>> Hello Jens,
>>
>> thank you very much!
>>
>> Is there a way with a stored proc to list all the trigger codes at once?
>
>
Author
23 Mar 2006 2:49 PM
ML
How the client application (e.g. Query Analyzer) handles the result-sets is
not controlled by the stored procedure.

You decide how you want your results displayed in QA by selecting the
appropriate option.


ML

---
http://milambda.blogspot.com/

AddThis Social Bookmark Button