Pages

Saturday, 30 July 2011

SQL Server Triggers.

1 comments
 
Tags : SQL Server 2005,SQL Server 2008,Triggers,DML Triggers,DDL Triggers,Logon Triggers.

Hi Friends,in this post i would like to explain Triggers in SQL Server.

* It is one kind of stored procedure, but triggers neither accept nor return any values.

* Trigger is an action which can be execute automatically.

* It is defined to execute automatically when the specified event is occurred.

Types of Triggers :


1) DML Triggers :

These triggers executes automatically when data manipulation language event occurs. DML events are insert,update,delete.

2) DDL Triggers :

These triggers executes when data definition language events such as create,alter,drop occurs.

3) Logon Triggers :

These triggers fires for logon events.


Difference between Trigger & Stored Procedure :

1) Trigger is implicit execution where as Stored Procedure is explicit execution.

2) Triggers doesn't allow any parameters & doesn't return any values.Stored Procedure can allow parameters & return values.


Advantages :

* We can schedule tasks basing on events.

Disadvantage :

* It is burden because triggers run on database.
* It is difficult to track the changes done by triggers on database.


Thank you...


Shout it

One Response so far.

  1. Anonymous says:

    Good Article...

Leave a Reply