How to call a stored procedure from a user defined function In SQL Server 2000
sql-server
Solution
Either you need to modify your stored procedure to be a user defined function or the other way around.
One crude way to achieve what you are looking for is to have your `exec` statement in a batch script and call that batch script from your function. Something like this:
create function <functionName>
exec master.sys.xp_cmpshell 'C:\storedProc.bat'
....
....
return @return
end
More on `xp_cmpshell` on MSDN.
Problem
How to call a stored procedure from a user defined function in SQL Server 2000