形式参数“@mode"未声明为 OUTPUT 参数,而是在请求的输出中传递的实际参数 [英] The formal parameter “@mode” was not declared as an OUTPUT parameter, but the actual parameter passed in requested output

查看:33
本文介绍了形式参数“@mode"未声明为 OUTPUT 参数,而是在请求的输出中传递的实际参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个存储过程:

ALTER PROCEDURE spCertificationType 
    @result nvarchar(15) output,
    @mode int 
AS
BEGIN
    if @mode = 1
    begin
        exec spGeneratedID 2, @result output
        print @result
    end
END

但是当我尝试执行它时,它出现了这个错误

but when I tried to execute it,it has this error

形式参数@mode"没有声明为 OUTPUT 参数,而是在请求的输出中传递的实际参数.

The formal parameter "@mode" was not declared as an OUTPUT parameter, but the actual parameter passed in requested output.

我尝试将 @mode 设置为这样的输出:

I tried to set @mode as output like this:

ALTER PROCEDURE spCertificationType 
    @result nvarchar(15) output,
    @mode int output
AS
BEGIN
    if @mode = 1
    begin
        exec spGeneratedID 2, @result output
        print @result
    end
END

但它返回一个空值.

有什么解决办法吗?提前致谢.

Any fix for this? Thanks in advance.

推荐答案

存储过程中参数的顺序是先使用输入参数再使用输出参数:-您可以查看此链接以获取有关存储过程的更多知识:-

the sequence of parameter in store procedure is that first use input parameter then use output parameter:- you can see this link for more knowledge of store procedure:-

http://www.codeproject.com/Articles/126898/Sql-Server-How-To-Write-a-Stored-Procedure-in-SQL

ALTER PROCEDURE spCertificationType 

     @mode int,
     @result nvarchar(15) output
 AS
 BEGIN
     if @mode = 1
   begin
    exec spGeneratedID 2, @result output
    print @result
   end
END

这篇关于形式参数“@mode"未声明为 OUTPUT 参数,而是在请求的输出中传递的实际参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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