Trigger
what is trigger? how to use,with example
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Satyapriya NayakRank #47 · 31.5K reputationPosted Jul 13, 2012, 3:30 AM EDT
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
Jignesh TrivediRank #16 · 50.3K reputationPosted Jul 13, 2012, 3:49 AM EDT
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.