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

编程入门 行业动态 更新时间:2024-10-10 11:24:15
本文介绍了形式参数“@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/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屋!

更多推荐

[db:关键词]

本文发布于:2023-03-19 00:10:05,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/625704.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:参数   是在   形式   声明   quot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!