Thursday, June 26, 2014

What is a trigger in SQL Server?

A trigger is an event or an action that precipitates other events. However a trigger in SQL Server is a special kind of stored procedure that automatically executes when an event occurs in the database server. 

If you want to know what is a stored procedure, follow this link:
http://hodentekhelp.blogspot.com/2011/06/what-is-stored-procedure.html

There are different kinds of events that can occur in a database server such as the following:
  • Data Manipulation language events such as,
Insert
Update
Delete
statements on a Table or View.
In these cases if a trigger is defined, it will fire (respond to the event) regardless of any changes are made to the rows of a table.
  • Data Definition Language events such as,
Create
Alter
Drop
and certain stored procedures that perform DDL-like operations
  • Log-on trigger
These fire when a session is established by a user.

 

No comments: