Jul 22, 2015

Why can we not execute a stored procedure inside a function

Technically, calling a stored procedure from a function is possible. But remember the purpose of the stored procedure and functions.
Purpose of function: The function is used to compute a value and hence must return a value. A function can be called from a select statement as long as it does not alter data. (Permanent table data, not temp tables)
Purpose of Stored procedure: The stored procedure is used to execute business logic and hence may or may not return a value.

No comments:

Post a Comment