通过将参数传递给存储过程来检查输出 [英] Check for output by passing a parameter to stored procedure
本文介绍了通过将参数传递给存储过程来检查输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我必须通过传递一个值来检查存储过程。
I have to check a stored proc by passing a value to it.
ALTER procedure [dbo].[Test]
(@name varchar(50),@sal int
)
as
begin
select Sal from Salary where Name=@name
end
我必须给它传递一个名字并在这里获得薪水它我怎么能这样做?
I have to pass a name to it and get salary here it self how can i do this??
推荐答案
好像你看了得到sal作为输出
it seems like you wat to get sal as output
ALTER procedure [dbo].[Test]
(@name varchar(50),@sal int out
)
as
begin
select @Sal = Sal from Salary where Name=@name
end
在sql中执行 sp
execute sp in sql
exec Test 'Name to pass', 0
快乐编码!
:)
Happy Coding!
:)
包括OUTPUT in你的参数是否输出。查看此处 [ ^ ]了解详情。
Include OUTPUT in your parameters if it's output. Check here[^] for details.
ALTER procedure [dbo].[Test]
(@name varchar(50)
)
as
begin
select Sal from Salary where Name=@name
end
exec [dbo].[Test] 'Your Name'
这篇关于通过将参数传递给存储过程来检查输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文