Jason Coon
Jason Coon

Reputation: 18441

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

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?

Upvotes: 2

Views: 947

Answers (1)

cjk
cjk

Reputation: 46465

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.

Upvotes: 3

Related Questions