从函数调用sp [英] calling a sp from a function
本文介绍了从函数调用sp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们可以在函数中调用存储过程吗?
如果是,该怎么做?
Hi,
can we call a stored procedure in a function?
If yes, how to do it?
CREATE PROCEDURE USP_TEST
AS
BEGIN
PRINT 1
END
CREATE FUNCTION TEST_1()
RETURNS INT
bEGIN
DECLARE @C INT
EXEC USP_TEST
RETURN @C
END
SELECT DBO.Test_1()
推荐答案
错误信息非常明确......你不能这样做。
http://www.unglesbee.com/wordpress/msg-557-sql-server-error-messages/ [<一个href =http://www.unglesbee.com/wordpress/msg-557-sql-server-error-messages/target =_ blanktitle =新窗口> ^ ]
查看是否可以用函数替换存储过程,或将函数转换为存储过程
Well the error message is quite clear ... you can't do that.
http://www.unglesbee.com/wordpress/msg-557-sql-server-error-messages/[^]
See if you can replace your stored procedure with a function, or convert your function into a stored procedure
这篇关于从函数调用sp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文