What are the difference between Stored procedure and function in sql server
Difference between Stored procedure and function
- Function must return any value
- Procedure can return single value or n number of rows or null
- Function has input parameter only
- Stored procedure can have input or output or both parameter
- Function can call from stored procedure
- Stored procedure can not call from function
- Function can not use any DML statement
- Stored procedure can use all DML statement
- Exception handling is not possible with function
- Stored procedure allow to use Exception handling
- Function can not use any command of transaction control like begin, commit, rollback
- Transaction can be begin, commit and rollback in procedure.
- Function compiles every time when its call
- Stored procedure compiles only once when it created
No comments:
Post a Comment