Skip to content

[存储过程] 怎么调用sqlserver存储过程? #653

Open
@fengdu126

Description

@fengdu126

Description

看文档是可以调用存储过程,但试了很多次都是调用出错。

大家有试过调用sqlserver存储过程成功的吗,是不是还要在function表里面增加记录,能否提供一个简单的例子,谢谢!

调用json:

{
    "User":{
        "@limit":2,
        "@offset":5,
        "@procedure()":"testproc(@limit,@offset)"
    }
  }

或者:


        "@limit":2,
        "@offset":5,
        "@procedure()":"testproc(@limit,@offset)"   
  }

后台显示错误的截图:

https://github.com/fengdu126/appokgo/blob/master/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20231220154209.png

提示:use of execute(string) method is not supported on this type of statement

存储过程是这样写的:

ALTER PROCEDURE [dbo].[testproc] (@limit int,@offset int)

AS
BEGIN

select @limit+@offset as sumqty

END

在数据库里面执行这条语句:execute testproc 4,5 是可以正常执行返回结果没有问题

怀疑是不是不支持sqlserver的存储过程用法,后台转成了 execute(testproc 4,5)这样去调用了?从而导致语法错误

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions