Answers

Question and Answer:

  Home  MS SQL Server

⟩ How To Modify Existing Triggers using "ALTER TRIGGER"?

If you want to make changes to an existing trigger, you could use the "ALTER TRIGGER" statements to refine the trigger again. The tutorial exercise below shows you how to modify the trigger defined in a previous tutorial:

USE GlobalGuideLineDatabase;

GO

ALTER TRIGGER dml_message ON ggl_users

AFTER INSERT, UPDATE, DELETE

AS

PRINT 'Time: '+CONVERT(VARCHAR(12),GETDATE());

PRINT 'Records are inserted, updated,'

+ ' or deleted in ggl_users';

GO

UPDATE ggl_users SET email='john@ggl' WHERE id = 1;

GO

Time: Jul 1 2007

Records are inserted, updated, or deleted in ggl_users

An extra printing statement is added the trigger.

 132 views

More Questions for you: