trigger
what is trigger? how to use,with example
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted Jul 13, 2012, 7:49 AM
SQL trigger is an SQL statements or a set of SQL statements which is stored to be activated or fired when an event associating with a database table occurs. The event can be any event including INSERT, UPDATE and DELETE.
A trigger is a database object that is attached to a table. In many aspects it is similar to a stored procedure.
The main difference between a trigger and a stored procedure is that the former is attached to a table and is only fired when an INSERT, UPDATE or DELETE occurs.
Mainly trigger used to apply some business logic.you can have some business logic to do before or after inserting a new record in a database table. Example in inventory when entry in sales table you can update stock table using trigger
Please refer
http://technet.microsoft.com/en-us/library/ms189799.aspx
hope this will help you.
Satyapriya NayakPosted Jul 13, 2012, 7:30 AM
Triggers are special kind of stored procedures that get executed automatically when an INSERT, UPDATE or DELETE operation takes place on a table.
Triggers can't be invoked on demand. They get triggered when the associated INSERT, DELETE or UPDATE is performed.
Please refer the below links
http://www.c-sharpcorner.com/uploadfile/shashikantray/create-delete-and-update-triggers-in-a-database/default.aspx
http://www.codeproject.com/Articles/25600/Triggers-Sql-Server
Thanks