Monday, May 11, 2009

Difference between Stored Procedure and Function

1. You cannot use stored procedure in a select statement likeselect but this is possible with UDF .
2. You can not return a table type variable with stored procedure but this is possible with user defined functions in sql Server.
3. Stored procedure may or may not return a value but a function has to return a value.
4. UDFs can accept a smaller number of parameters than stored procedures. UDFs can have up to 1024 parameters, whereas stored procedures support up to 2100 parameters. This is a relatively minor limitation because most routines require a much smaller number of parameters.
5. UDFs cannot call stored procedures (except extended procedures), whereas stored procedures can call other procedures.

No comments: