RSS

UDF VS Strore Procedure

11 Mar
Function Stored Procedure
1. UDF are simpler to invoke than Stored Procedures from inside another SQL statement. 1. They are Complex to Invoke.
2. Function return type could be scalar or table or table values(SQL Server). 2. It returns always integer value by default zero.
3. The User Defined Function must be prefaced with the owner name. 3.DBO in this case. Not mandatory.
4. A UDF is always used to return a value or a table object. 4. You can also get values back from a stored procedure by the return code (integer only) or an output parameter.
5. Functions are not precompiled. 5. It is pre compiled execution plan.
6. Function returns only one value at a time. 6. It returns more than one value at a time.
7. We can call the functions in SQL statements (select max(sal) from emp). 7.We cannot call Stored Procedures in SQL Statements.
8. Function parameters are always IN, no OUT is possible. Output parameters must be returned as return values. 8.Stored procedures can have input and output parameters.
Advertisements
 
Leave a comment

Posted by on March 11, 2011 in Uncategorized

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: