| Lesson 7 || Modifying triggers |
| Objective || Practice modifying triggers. |
Modifying triggers in SQL-Server 2016
If your business rules change, you might need to modify your triggers, using either Enterprise Manager or Transact-SQL.
Using Enterprise Manager
To use Enterprise Manager to modify your triggers:
- Right-click the name of the table that the trigger is assigned to.
- Choose the All Tasks | Manage Triggers menu option, and select the trigger to modify from the drop-down list.
- Enter the appropriate Transact-SQL statements in the Trigger Properties dialog box, shown below:
ALTER TRIGGER statement to modify a trigger. The syntax for this statement is shown in the following SlideShow.
The second way to modify a trigger is by using Transact-SQL code.
As you probably noticed, the syntax for
ALTER TRIGGER is almost the same as the syntax for
Therefore, an alternative to modifying your triggers is to delete and re-create them. Be aware that if you do so, you will lose any reference to the trigger from dependency objects, as well as any permissions assigned to that object.
In the next lesson, you will learn how to modify a trigger so that it conforms to unique business rules.