Home All Groups Group Topic Archive Search About

SSMS not displaying DB triggers

Author
25 Sep 2007 2:50 PM
Jimmy Jones
I have created several triggers on a DBbut they do not show up under
server\databases\MyDB\Programmability\Database Triggers

If I use the following sql command I can list them in results:
Use MyDB
SELECT *
FROM sys.triggers

All of the triggers were created using SQL similar to this:
CREATE TRIGGER dbo.trigMyTrigger
ON dbo.tblMyTable
AFTER INSERT
AS
  --Declare Vars
  BEGIN
  --Code Here
  END
GO

All of the triggers work but I want to make a change to a few of them to
alter some of the data they are updating.  Rather than rewrite them from
scratch it would be handy if I could right-click and modify them like I do
with my stored procedures.

I have double checked that they are not in any of the system DBs or in
Server Objects\Triggers

I added the AdventureWorks DB and I can see the trigger that comes with it.

Author
25 Sep 2007 3:19 PM
Tibor Karaszi
The folder you mention only list DDL triggers. For DML triggers (like the one you posted code for),
expand the table in SSMS and you will see a trigger folder (under each table).

Show quote
"Jimmy Jones" <JimmyJo***@discussions.microsoft.com> wrote in message
news:9E284DE7-0165-46B9-B62F-6BFD93BDFBE3@microsoft.com...
>I have created several triggers on a DBbut they do not show up under
> server\databases\MyDB\Programmability\Database Triggers
>
> If I use the following sql command I can list them in results:
> Use MyDB
> SELECT *
> FROM sys.triggers
>
> All of the triggers were created using SQL similar to this:
> CREATE TRIGGER dbo.trigMyTrigger
> ON dbo.tblMyTable
> AFTER INSERT
> AS
>  --Declare Vars
>  BEGIN
>  --Code Here
>  END
> GO
>
> All of the triggers work but I want to make a change to a few of them to
> alter some of the data they are updating.  Rather than rewrite them from
> scratch it would be handy if I could right-click and modify them like I do
> with my stored procedures.
>
> I have double checked that they are not in any of the system DBs or in
> Server Objects\Triggers
>
> I added the AdventureWorks DB and I can see the trigger that comes with it.
Author
25 Sep 2007 4:26 PM
Jimmy Jones
Thanks for the quick reply.

Show quote
"Tibor Karaszi" wrote:

> The folder you mention only list DDL triggers. For DML triggers (like the one you posted code for),
> expand the table in SSMS and you will see a trigger folder (under each table).
>
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
>
> "Jimmy Jones" <JimmyJo***@discussions.microsoft.com> wrote in message
> news:9E284DE7-0165-46B9-B62F-6BFD93BDFBE3@microsoft.com...
> >I have created several triggers on a DBbut they do not show up under
> > server\databases\MyDB\Programmability\Database Triggers
> >
> > If I use the following sql command I can list them in results:
> > Use MyDB
> > SELECT *
> > FROM sys.triggers
> >
> > All of the triggers were created using SQL similar to this:
> > CREATE TRIGGER dbo.trigMyTrigger
> > ON dbo.tblMyTable
> > AFTER INSERT
> > AS
> >  --Declare Vars
> >  BEGIN
> >  --Code Here
> >  END
> > GO
> >
> > All of the triggers work but I want to make a change to a few of them to
> > alter some of the data they are updating.  Rather than rewrite them from
> > scratch it would be handy if I could right-click and modify them like I do
> > with my stored procedures.
> >
> > I have double checked that they are not in any of the system DBs or in
> > Server Objects\Triggers
> >
> > I added the AdventureWorks DB and I can see the trigger that comes with it.
>
Author
25 Sep 2007 3:39 PM
Aaron Bertrand [SQL Server MVP]
>I have created several triggers on a DBbut they do not show up under
> server\databases\MyDB\Programmability\Database Triggers

What you created is not a database trigger, it is a table trigger.  These
are not grouped together under a single folder; since they each apply to
only one table, they are under the Triggers folder under each table's
individual node in Object Explorer.

Aaron

AddThis Social Bookmark Button