Click here to Skip to main content
15,748,973 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Friends.

I want to know about triggers.

Which Place it is used and is it only for table .

can we apply triggers on SP

A trigger is a special kind of stored procedure that automatically executes when an event occurs in the database server. DML triggers execute when a user tries to modify data through a data manipulation language (DML) event. DML events are INSERT, UPDATE, or DELETE statements on a table or view.

You can use triggers in a situation where you need to perform any calculation at the time of insert, update and delete operation.
For eg: In case of delete if you want add the same value in another table to maintain history.

Triggers can not be invoked manually, it will execute automatically.

You can not use triggers on SP.

For more details please refer below links:[^][^]

Share this answer
Prasad_Kulkarni 26-Apr-12 4:36am    
Good explanation! +5!
Arul R Ece 26-Apr-12 4:50am    
Thankn u praveen..nice
Be friendly to Google and try to search there first ,
here are few links to learn :[^][^]

and many more from google .
hope this helps
Share this answer
Prasad_Kulkarni 26-Apr-12 4:36am    
member60 26-Apr-12 5:14am    
thank you Prasad
Please refer following threads:

A good article on CP:
Triggers -- Sql Server[^]

This might help you more:
SQL triggers[^]
An Introduction to Triggers -- Part I[^]
Exploring SQL Server Triggers[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900