Jun 25, 2013

Triggers in Sql Server : Part - 1

A Trigger is a special kind of stored procedure that automatically executes when an event occurs in the database.

Types of Triggers
  • DDL Triggers execute on data definition language (DDL) events like CREATE, ALTER, and DROP statements, and certain system stored procedures that perform DDL-like operations. 
  • DML Triggers execute on data manipulation language (DML) event like INSERT, UPDATE, or DELETE statements on a table or view. These triggers fire when any valid event is fired, regardless of whether or not any table rows are affected.
  • DML Triggers are of two types.
    • After Triggers: These triggers run after once insert, update or delete operation is executed on a table
    • Instead Of Triggers: These triggers run before insert, update or delete operation and do not let execute actual insert, update or delete performed on the table.
When a trigger is executed, magic tables "inserted/deleted" are automatically created and are accessible in the trigger.

In the next article, we will learn more about Magic Tables

Home Next >>

    Choose :
  • OR
  • To comment
1 comment:
Write Comments