How To Modify Existing Triggers using "ALTER TRIGGER"?
Submitted by: AdministratorIf 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.
Submitted by: Administrator
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.
Submitted by: Administrator
Read Online MS SQL Server Job Interview Questions And Answers
Top MS SQL Server Questions
☺ | How To Execute the Cursor Queries with "OPEN" Statements? |
☺ | What Happens If Strings Are Casted into Wrong Code Pages in MS SQL Server? |
☺ | How To Convert a Numeric Expression from One Data Type to Another? |
☺ | How To Create a View on an Existing Table in MS SQL Server? |
☺ | PHP MSSQL - How To Display a Past Time in Days, Hours and Minutes? |
Top Databases Programming Categories
☺ | RDBMS Interview Questions. |
☺ | SQL Interview Questions. |
☺ | SSRS Interview Questions. |
☺ | Database Administrator (DBA) Interview Questions. |
☺ | Sybase Interview Questions. |