Monday, March 19, 2012

Missing Triggers on SQL 2005/Server Management Studio

I have a few SQL 2005 databases set up, some of which have triggers.

Recently, the database triggers stopped appearing in SMS. They are still there. They still run. I can still manually CREATE, ALTER, or DROP triggers via SQL queries. However, when I open a database and navigate to Programmability > Database Triggers nothing shows up. Right clicking the folder produces no worthwhile options (just Reports and Refresh).

Until this puzzling change occured a few days ago, triggers were appearing in the aforementioned location. Right clicking yielded many options including the options to create, drop or whatever else. I thought this might be a permissions issue, but as I said, I can still work on triggers via queries.

Does anyone have any idea what is going on?

Thanks, Jeff

I don't think you found triggers under programmability. You found stored procedures there.

The triggers are the expansions of the tables not the database.

Drop down the table and you'll see the triggers.

Adamus

|||

i hope the trigger you mentioned is DDL trigger. you can make DDL triggers are of two scope. one database level and the other one at the server level. The database trigger can found in Database Programability -- Database triggers.

the server level trigger can be seen in Server Object -- Server Triggers

System objects for DDL Triggers

You can use the sys.triggers catalog view to see database-level DDL triggers. The parent_class column in this catalog view has 0 as the value for DDL triggers. You can use the sys.server_triggers catalog view to get a list of server-level DDL triggers. The sys.trigger_events and sys.server_trigger_events catalog views contain a row for each time a database-level and server-level trigger was fired, respectively.

also read these


Query System Object for DDL

SELECT Name, s.type_desc SQL_or_CLR,is_disabled, e.type_desc FiringEvents
FROM sys.server_triggers s
INNER JOIN sys.server_trigger_events e ON s.object_id = e.object_id

Where can I find DDL trigger in SSMO

Databaselevel DDL triggers are listed in the Programmability\Database Triggers folder in Object Explorer. The server-level triggers are listed under the Server Objects\Triggers folder in Object Explorer.

Delete DDL Trigger

The ON DATABASE or ON ALL SERVER clause should be used with DROP TRIGGER to delete a DDL trigger, ALTER TRIGGER to modify a DDL trigger definition, DISABLE TRIGGER to disable a DDL trigger, and ENABLE TRIGGER to enable a DDL trigger.

Permission
The CONTROL SERVER permission is required to create a DDL trigger at the server scope, and ALTER ANY TRIGGER permission is required to create a DDL trigger at the database scope

Madhu

|||Thank you both of you! Both posts were helpful, but Adamus more directly answered my question. I could swear that the triggers I had created were found in Programmability but now I see some of them in the table expansion themselves.

No comments:

Post a Comment