Is there any way to send functions as parameters to stored procedures?
create procedure stp_dummy
@input nvarchar(255)
as select @input
exec stp_dummy a_function_that_returns_string('abracadabra')
(Of course that I know that the function can be called previously but I would like to know if the direct solution is available.)
I know this isn’t the answer you’re looking for, but the only way to do this is to declare a local variable, assign the function value to this, and use this as your parameter value:
With SQL Server 2008, this can be done in 2 lines: