Trigger Management - Managing Triggers
(Page 3 of 4 )
You can manage triggers using GUI tools such as SQL Server Management Studio or Visual Studio, or by using Transact-SQL statements.
Managing DML Triggers in Management Studio
You can access triggers from Management Studio:
- Expand the node of the table with which the trigger is associated.
- Expand the trigger’s node.
- Right-click the trigger and choose Modify from the pop-up menu.
SQL Server displays a form for editing trigger properties (see Figure 9-1). This editor is very similar to the editor you use to edit stored procedures.
To create a new trigger on the table, right-click the trigger’s subnode of the table and choose New Trigger from the pop-up menu. SQL Server initially fills the form with a template for creating a new trigger.
Once you have created or modified the trigger, you can choose Assisted Editor | Check Syntax to verify it, and then File | Save to attach it to the table.

Figure 9-1. Managing triggers in Management Studio
You can delete a trigger by right-clicking the trigger and choosing Delete from the pop-up menu.
Managing DDL Triggers from Management Studio
Database-level DDL triggers are managed from server | Databases | database | Programmability | Database Triggers (see Figure 9-2). Server-level DDL triggers are managed from server | Programmability | Server Triggers.
Managing Triggers Using Transact-SQL Statements
SQL Server has a rich palette of system stored procedures, functions, and views for managing triggers from Transact-SQL.

Figure 9-2. Managing database-level DDL triggers
Next: Listing Triggers >>
More MS SQL Server Articles
More By McGraw-Hill/Osborne
|
This article is excerpted from chapter nine of the book Microsoft SQL Server 2005 Stored Procedure Programming in T-SQL and .NET, written by Dejan Sunderic (McGraw-Hill/Osborne, 2006; ISBN: 0072262281). Check it out today at you favorite bookstore. Buy this book now.
|
|