从SQL Server函数调用StoredProcedures [英] calling StoredProcedures from SQL server Function

查看:80
本文介绍了从SQL Server函数调用StoredProcedures的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以从SQL UserDefined Functions调用StoredProcedures.如果可以的话,我们该怎么做?

请帮帮我.

谢谢
克里希纳

is its possible to call StoredProcedures from SQL UserDefined Functions. if so how can we do that?

Please help me.

Thanks
Krishna

推荐答案

我不认为可以在函数中调用存储过程.要么将存储过程修改为一个函数,要么将函数修改为一个存储过程.

在您的情况下,您可以将存储过程转换为一个函数,以便可以在函数内部调用它.您可以像在存储过程中一样在新函数中执行DML.但是要使其与其他任何函数一样工作,转换为函数的存储过程必须返回一个值.

您可能要探讨的其他选择是使用CLR.

希望这会有所帮助.
I do not think calling stored procedure in a function is possible. It''s either you modify the stored procedure to be a function, or modify the function to be a stored procedure.

I your case, you may convert your the stored procedure into a function so that it can be called inside the function. You can do the DMLs inside your new function just like when it was a stored procedure. But to make it work, as with any other function, your stored procedure converted to function must return a value.

Other option that you may want to explore is the use of CLR.

Hope this helps.


这篇关于从SQL Server函数调用StoredProcedures的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆