The below are the differences between Triggers and Stored Procedures .
1.Triggers cannot return a value where as stored procedures may return a value.
1.Triggers cannot return a value where as stored procedures may return a value.
2.We cannot pass parameters to the triggers where as in stored procedures we can pass parameters.
3. We can write a stored procedures with in a trigger where as in procedures we can't write a trigger.
4. Triggers are implicitly fired whenever insert , update or delete operations take place on a table where procedures needs to be explicitly called by the programmer .
5. We can implement triggers on tables or views where as stored procedures can be written on the database too.
6. We cannot automate / schedule a trigger where as SP can be scheduled to execute on a predefined time.
7.We cannot use print command inside a trigger where as in SP we can user print command for debugging purpose .
8.We cannot call a trigger from the application side or from front end where as SP can be called from front end application files such as .asp , ,aspx and ascx files etc .
9.Triggers will execute automatically when an event (Inser , Update and Delete) is fired where as SP can execute by using EXEC command.
9.Triggers will execute automatically when an event (Inser , Update and Delete) is fired where as SP can execute by using EXEC command.
No comments:
Post a Comment