The main differences between functions and stored procedures are
1)Functions can be used in SQL Queries where as stored procedures can't be used in SQL queries.
2)Stored procedure can run independently. It can be executed using EXECUTE or EXEC command where as function cannot run independently.
3)stored procedures has both in and out parameters,but the function takes only in parameters.
4)A FUNCTION is always returns a value using the return statement. A PROCEDURE may return one or more values through parameters or may not return at all
5)Functions are normally used for computations where as procedures are normally used for executing business logic.
6)Stored procedure is precompiled execution plan where as functions are not.
1)Functions can be used in SQL Queries where as stored procedures can't be used in SQL queries.
2)Stored procedure can run independently. It can be executed using EXECUTE or EXEC command where as function cannot run independently.
3)stored procedures has both in and out parameters,but the function takes only in parameters.
4)A FUNCTION is always returns a value using the return statement. A PROCEDURE may return one or more values through parameters or may not return at all
5)Functions are normally used for computations where as procedures are normally used for executing business logic.
6)Stored procedure is precompiled execution plan where as functions are not.
No comments:
Post a Comment