I’ve got a table with two columns(among others): id and created_in_variant and a stored procedure that calculates the created_in_variant value basing on the id. I’d like to do something like this:
UPDATE [dbo].[alerts] SET [created_in_variant] = find_root [id]
Is there a nice way to do it?
You may want to look at using a scalar valued function (also known as a user defined function) instead of a stored procedure for this type of problem.
EDIT: Here is some information concerning SVFs : Click
EDIT 2: Here is some more information from 15 Seconds