Monday, March 12, 2012

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

Hello,
how can I list all Triggers like sp_tables or sp_databases?
Thanks for any help in advance!
Regards,
Andreas KlemtHi,
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
--|||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
"Jens" <Jens@.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
> --
>|||Add Object_Definition(id) to the select list.
"Andreas Klemt" <aklemt68@.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?|||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
"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" <aklemt68@.hotmail.com> wrote in message
> news:OspiUylTGHA.5172@.TK2MSFTNGP12.phx.gbl...
>

No comments:

Post a Comment