Creating and Dropping Triggers

To create a trigger, you can use the CREATE TRIGGER statement. In this statement, you must provide the name of the trigger, the object where the trigger is defined, and the action or actions that will fire the trigger.

The CREATE TRIGGER statement must be executed as the only statement in a batch. The same restriction applies to the CREATE PROCEDURE, CREATE VIEW, CREATE RULE, and CREATE FUNCTION statements.

You can use the WITH ENCRYPTION option to encrypt the trigger definition. In this way, you can prevent user access to the trigger's internal code. Be careful when using this option, because there is no way to decrypt an encrypted trigger. It is recommended that you save the CREATE TRIGGER script in ...

Get Microsoft® SQL Server™ 2000 Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.