Why can we not execute a stored procedure inside a function in SQL Server

前端 未结 7 1496
情话喂你
情话喂你 2020-12-17 02:23

Why can we not execute a stored procedure inside a function when the opposite is possible?

相关标签:
7条回答
  • 2020-12-17 03:12

    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.

    0 讨论(0)
提交回复
热议问题