Creating DML Triggers

You can create and manage triggers in SQL Server Management Studio or directly via Transact-SQL (T-SQL) statements. The Object Explorer in SSMS provides a simple means of creating triggers that you can use to generate the underlying T-SQL code. You expand the Object Explorer tree to the user table level and then right-click the Triggers node. When you select the New Trigger option, as shown in Figure 30.1, the trigger template shown in the right pane of Figure 30.1 appears.

Figure 30.1 Using SSMS to create triggers.


You can populate the trigger template by manually editing it, or you can select the Query menu option Specify ...

Get Microsoft® SQL Server 2008 R2 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.