SQL Server: How to execute UPDATE from within recursive function?

会有一股神秘感。 提交于 2019-12-24 01:25:54

问题


I have a recursive scalar function that needs to update a record in another table based on the value it is returning, however UPDATE statements are not allowed in the function.

How can I update the table from within the function?


回答1:


UPDATE statements are not allowed in the function

That's the rule - functions are not allowed to have any data-changing side-affects.

You have to use a Stored Procedure to UPDATE.



来源:https://stackoverflow.com/questions/3805250/sql-server-how-to-execute-update-from-within-recursive-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!