Database Triggers in SQL Server:-

  • A database trigger is also a ‘named block’ like procedures executed implicitly.

Procedures in SQL Server :                          

  1. Called explicitly                               
  2. Procedure can be created  without a table.
  3. Procedure accepts ‘parameters’.
  4. procedure returns a value.

Triggers in SQL Server:

  1. Called implicitly.
  2. Trigger can’t be created without a table.
  3. Trigger won’t accept parameters.
  4. Trigger won’t return a value.

Triggers are mainly created for:

  • To implement complex business rules & validations.
  • To do auditing.
  • To provide security.

Business rules are Two Types:

Declarative : Integrity constraints.

Procedural:  Database triggers.

Trigger Types in SQL Server  :-

It can be divided into two types :

  1. DML trigger
  2. DDL triggers