使用输入参数执行SQL Server存储过程 [英] Execute SQL Server stored procedure with input parameter

查看:56
本文介绍了使用输入参数执行SQL Server存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您能否建议如何从Sql Server中执行接收输入参数的存储过程?我试过了,但是失败了:

Could you suggest please how to execute from Sql Server a stored procedure that receives an input parameter? I tried this but it failed:

EXEC GetFilmsInCategory('SF'); 

顺便说一句,存储过程已正确定义.我从可视界面执行了该命令,并成功运行,并自动生成了以下代码:

The stored procedure is correctly defined, by the way. I executed it from the visual interface and it worked, with this code generated automatically:

DECLARE @return_value int

EXEC @return_value = [dbo].[GetFilmsInCategory] @CatNume = N'SF'

SELECT 'Return Value' = @return_value

我也发现了这个自动生成的代码...冗长,因为我期望的是与我最初尝试的类似的东西:

I find this automatically generated code too... lengthy as I was expecting something similar to what I initially tried:

EXEC GetFilmsInCategory('SF'); 

您能解决此问题还是提供替代方法?谢谢!

Can you fix this or offer an alternative? Thank you!

安娜

推荐答案

尝试:

EXEC GetFilmsInCategory 'SF'

这篇关于使用输入参数执行SQL Server存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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