December 24, 2012

Stored Procedure and Function in SQL

Difference between Stored procedure and functions in SQL Server



Sr No
 
Storde Procedures
Functions
1
Can be used in Select Statements
No
Yes
 
 
 
 
2
Can take input Parameters
yes
yes
 
 
 
 
3
Can take output parameters
yes
No
 
 
 
 
4
text, ntext, image & timestamps
returns
can not returns
 
 
 
 
5
Input / Output Parameters
both
input
 
 
 
 
6
Insert / UPDATE / Delete
allowed
Not Allowed
 
 
 
 
7
DML
allowed
Not Allowed
 
 
 
 
8
Select
 
only
 
 
 
 
9
Calling type
in SP Function can be called
Vice a versa not possible
 
 
 
 
10
Transaction
handled
Not handled
          11
WHERE/HAVING/SELECT
not allowd
can be used

No comments:

Post a Comment