如何在 SQL Server 2000 中从用户定义的函数调用存储过程
问题描述:
如何从 SQL Server 2000 中的用户定义函数调用存储过程
How to call a stored procedure from a user defined function in SQL Server 2000
答
要么您需要将存储过程修改为用户定义的函数,要么反之.
Either you need to modify your stored procedure to be a user defined function or the other way around.
实现您正在寻找的一种粗略的方法是将您的 exec
语句放在批处理脚本中,然后从您的函数中调用该批处理脚本.像这样:
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
更多关于 xp_cmpshell
在 MSDN 上.
More on xp_cmpshell
on MSDN.