tags:

views:

20

answers:

1

Suppose I have a 2 column table with columns (arg, value) and a user-defined function foo.

Is there a way to have an update query that goes through the table and calls foo with argument arg and sticks the results in column value for every row in the table?

+3  A: 

Assuming SQL Server the syntax is

Update YourTable
SET value = dbo.foo(arg)

It is often more efficient to not use scalar UDFs for Row by Row processing however. What is the scalar UDF doing?

Martin Smith