Functions vs Stored Procedures

后端 未结 12 605
我寻月下人不归
我寻月下人不归 2020-12-02 06:26

Let\'s say I have to implement a piece of T-SQL code that must return a table as result. I can implement a table-valued function or else a stored procedure that returns a se

12条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-02 06:56

    I personally use table valued functions when all I am returning is a single table with no affects. Basically I treat them like parameterized views.

    If I need multiple recordsets returned or if there will be values updated in tables, I use a stored procedure.

    My 2 cents

提交回复
热议问题