Showing posts with label addition. Show all posts
Showing posts with label addition. Show all posts

Monday, February 20, 2012

List all triggers for a table or an entire database

How can I get a list of all the triggers associated with a particular
table in a database. And in addition, how can I get a list of all
triggers for the entire database (meaning all triggers associated with
all tables)? Thanks!!
Regards,
Troy
Troy,
[vbcol=seagreen]
answered my own question... here's the query in case someone else is
wondering:
SELECT S2.[name] TableName, S1.[name] TriggerName, CASE WHEN S1.deltrig
> 0 THEN 'Delete' WHEN S1.instrig > 0 THEN 'Insert' WHEN S1.updtrig > 0
THEN 'Update' END 'TriggerType' FROM sysobjects S1 JOIN sysobjects S2 ON
S1.parent_obj = S2.[id] WHERE S1.xtype='TR'
Regards,
Troy

List all Foreign Keys, Primary Keys, Indexes

With Microsoft SQL Server is there a way to list all Foreign Keys, Primary
Keys, Indexes etc. in addition to the database diagrams?
Thanks
Schema: How do I list all the indexes in a database?
http://www.aspfaq.com/show.asp?id=2541
Schema: How do I show all the primary keys in a database?
http://www.aspfaq.com/show.asp?id=2104
Schema: How do I find all the foreign keys in a database?
http://www.aspfaq.com/show.asp?id=2520
AMB
"Craig" wrote:

> With Microsoft SQL Server is there a way to list all Foreign Keys, Primary
> Keys, Indexes etc. in addition to the database diagrams?
>
> Thanks
>
>

List all Foreign Keys, Primary Keys, Indexes

With Microsoft SQL Server is there a way to list all Foreign Keys, Primary
Keys, Indexes etc. in addition to the database diagrams?
ThanksSchema: How do I list all the indexes in a database?
http://www.aspfaq.com/show.asp?id=2541
Schema: How do I show all the primary keys in a database?
http://www.aspfaq.com/show.asp?id=2104
Schema: How do I find all the foreign keys in a database?
http://www.aspfaq.com/show.asp?id=2520
AMB
"Craig" wrote:

> With Microsoft SQL Server is there a way to list all Foreign Keys, Primary
> Keys, Indexes etc. in addition to the database diagrams?
>
> Thanks
>
>

List all Foreign Keys, Primary Keys, Indexes

With Microsoft SQL Server is there a way to list all Foreign Keys, Primary
Keys, Indexes etc. in addition to the database diagrams?
ThanksSchema: How do I list all the indexes in a database?
http://www.aspfaq.com/show.asp?id=2541
Schema: How do I show all the primary keys in a database?
http://www.aspfaq.com/show.asp?id=2104
Schema: How do I find all the foreign keys in a database?
http://www.aspfaq.com/show.asp?id=2520
AMB
"Craig" wrote:
> With Microsoft SQL Server is there a way to list all Foreign Keys, Primary
> Keys, Indexes etc. in addition to the database diagrams?
>
> Thanks
>
>