what is the difference between function and stored procedure
c#
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Yadagiri ReddyPosted Oct 27, 2014, 10:01 AM
----------
1) can be used with Select statement
2) Not returning output parameter but returns Table variables
3) You can join UDF
4) Cannot be used to change server configuration
5) Cannot be used with XML FOR clause
6) Cannot have transaction within function
Stored Procedure
-----------------
1) have to use EXEC or EXECUTE
2) return output parameter
3) can create table but won't return Table Variables
4) you can not join SP
5) can be used to change server configuration
6) can be used with XML FOR Clause
7) can have transaction within SP
Lawrence PondPosted Oct 27, 2014, 1:09 AM
- Table Valued Function returns table
- Scalar Values Function single result
- Aggregate Function
- System Functions
Stored proceduresTypcially functions are the building blocks single unit of work that a stored procedure uses and the stored proc is the container to do the work.
store procedures can return one or more results by using output field types
Functions call from inline sql
select fConcatString(n.FirstName, n.LastName ) from Names n ;
where you cannot run a stored procedure from a select statement.
Abhishek KumarPosted Oct 25, 2014, 12:52 PM
Please follow the below link
http://sqlhints.com/2012/06/16/difference-between-stored-procedure-and-user-defined-function-in-sql-server/
Abhishek
Ranjit PowarPosted Oct 25, 2014, 5:13 AM