Wednesday, 29 April 2015

SQL Server Triggers

Trigger : A trigger is a special kind of stored procedure that automatically executes when an event occurs in the database server. A trigger is really an event handler. SQL Server allows users to create triggers (event handlers) for 3 types of events:

  • DML Event - Occurs when a DML (Data Manipulation Language) statement: INSERT, UPDATE or DELETE, is executed.
  • DDL Event - Occurs when a DDL (Data Definition Language) statement: CREATE, ALTER, or DROP, is executed.
  • Logon Event - Occurs when a user logins to the Server.

There are 3 different types of triggers (event handlers) based on the types of events they are triggered by:

  • DML Trigger - Executes in response to a DML event.
  • DDL Trigger - Executes in response to a DDL event.
  • Logon Trigger - Executes in response to a logon event.

No comments:

Post a Comment