Sunday 12 May 2013

Difference between Stored Procedure and Function

Difference between Stored Procedure and Function


1) Procedure can return zero or n values whereas function can return one value which is mandatory
2) Procedures can have input, output parameters for it whereas functions can have only input parameters.
3) Procedure allows select as well as DML(INSERT/UPDATE/DELETE) statements in it whereas function allows only select statement in it.
4) Functions can be called from procedure whereas procedures cannot be called from function.
5) Exception can be handled by try-catch block in a procedure whereas try-catch block cannot be used in a function.
6) We can go for transaction management in procedure whereas we can't go in function.
7) Procedures cannot be utilized in a select statement whereas function can be embedded in a select statement.

Differences between stored procedures and triggers

Differences between storedprocedures and triggers 

1. When you create a trigger you have to identify event and action of your trigger but when you create s.p you don't identify event and action 

2.Trigger is run automatically if the event is occured but s.p don't run automatically but you have to run it manually 

3. Within a trigger you can call specific s.p but within a sp you cannot call atrigger 

4.Trigger execute implicitly whereas store procedure execute via procedure call from another block. 

5.We can call a stored procedure from front end (.asp files, .aspx files, .ascx files etc.) but we can't call a trigger from these files. 

6. Stored procedure can take the input parameters, but we can't pass the parameters as an input to a trigger. 

What are different types of caching in ASP.Net? Caching in asp.net


There are three main types of Caching:
  1. Page Output caching : Caching complete page
  2. Fragment caching: Caching a portion of a page
  3. Data Caching: Caching data