Monday, November 10, 2014

SQL Server Difference FAQs-2

SQL Server Difference FAQs-2

  1. What are the differences between Instead of Triggers and After Triggers?

S.NoInstead of TriggersAfter Triggers
1Each table or view can have one INSTEAD OF trigger for each triggering action (UPDATE, DELETE, and INSERT)A table can have several AFTER triggers for each triggering action.
2INSTEAD OF triggers fire in place of the triggering action and before constraints are processed.AFTER triggers fire after the triggering action (INSERT, UPDATE, or DELETE) and after any constraints are processed.
  1. What are the differences between Views and User-Defined Functions?

S.NoViewsUser-Defined Functions
1Views cannot accept parameters.User-Defined Functions can accept parameters.
2Output of the Views cannot be directly used in the SELECT clause.Output of the User-Defined Functions can be directly used in the SELECT clause.
  1. What are the differences between Triggers and Stored Procedures?

S.NoTriggersStored Procedures
1Triggers cannot return a valueStored Procedures may return a value
2We cannot pass parameters in TriggersWe can pass parameter in Stored Procedures
3We can write a Stored procedure within a TriggerWe cannot write a Trigger within a Stored Procedure
4Triggers are implicitly fired whenever insert, update or delete operations take place on tableStored Procedures need to be explicitly called by the programmer
5Triggers can only be implemented on Tables or ViewsStored procedures can be written for the Database
We cannot schedule a trigger.
Stored procedures can be scheduled through a job to execute on a predefined time
We cannot use the print command inside a trigger.
We can use the Print commands inside the stored procedure for debugging purpose
We cannot call a trigger from these files.
We can call a stored procedure from front end (.asp files, .aspx files, .ascx files etc.)

No comments:

Post a Comment