存储过程未执行 [英] Stored procedure not getting executed

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

问题描述





我有一个存储过程如下:



Hi,

I have a stored procedure as given below:

Create Procedure ProcName(@transname varchar(200),@transno varchar(200))
As
BEGIN
set nocount on 
select tb1.pono,tb2.billno from table1 tb1
inner join table2 tb2 on tb1.id=tb2.id
where @transname=@transno
set nocount off
END





当我执行此操作时,我得不到任何输出。



但是如果我删除一个参数@transname并改变下面的程序,我得到输出。





When I execute this I dont get any output.

But if I remove one parameter @transname and alter the procedure as below, I get the output.

Create Procedure ProcName(@transno varchar(200))
As
BEGIN
set nocount on 
select tb1.pono,tb2.billno from table1 tb1
inner join table2 tb2 on tb1.id=tb2.id
where pono=@transno
set nocount off
END





实际上,我希望用户传递参数@transname并执行查询。请帮助我实现这一目标。我在这里错过了什么?或者我做了什么错误?



Actually, I want the user to pass the parameter @transname and execute the query. Please help me achieve that. What am I missing here? or what mistake I have done?

推荐答案

我认为在第一个程序中你的错误就像你在比较你的两个程序参数在你的条件其中@ transname = @ transno 并且根据我的理解transname和transno是两个不同的值,为什么你的where条件不是fullfill所以什么都不会从你的table1和table2中选择所以请修改你的where条件并检查出来
i think in first procedure your mistake is like you are comparing your two procedure parameter in your where condition where @transname=@transno and as per my understanding transname and transno are two different value and that why your where condition is not fullfill so nothing will be selected from your table1 and table2 so please modified your where condition and check it out


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

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