更新程序问题中的查询 [英] update query in procedure issue

查看:103
本文介绍了更新程序问题中的查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ALTER procedure [dbo].[usp_assignedto]
(
@employeeid int,
@issuetrackerid int,
@testerid int
--@status int
)
as
begin 
set nocount on

if (status !=1) or (status !=2)
begin 
update issuesdetails set assignedto = @employeeid , testerassign=@testerid where issuetrackerid=@issuetrackerid
end
begin
update issuesdetails set assignedto=@employeeid,status =2 , testerassign=@testerid where issuetrackerid=@issuetrackerid
end
 

end





首先,如果(状态!= 1)或(状态!= 2)这个条件不起作用,如果我传递参数@status它有效但我没有通过任何从前端的参数,所以我不能通过这个参数。所以也请替换它。



我尝试使用这个,上一期更新所有问题的状态标签问题已经解决,但现在我无法更新状态,点击提交点击不会发生变化。



请给我一些解决方案



紧急删除 - OriginalGriff [/ edit]



First of all the "if (status !=1) or (status !=2)" this condition is not working , if i pass the parameter @status It works but I am not passing any parametr from front end so I cant pass this parameter . So Please give substitute for this also .

I tried using this , the previous issue of updating the status label for all the issue is resolved but now I cant update the status , On submit click no change occur.

Please give me some solution

[edit]Urgency deleted - OriginalGriff[/edit]

推荐答案

想想你在说什么:

Think about what you are saying:
if (status !=1) or (status !=2)

显示单个值那次测试失败了。你的意思是AND而不是OR?

Show me a single value that fails that test. Did you mean AND rather than OR?


你可以像下面那样交换更新语句:

You can just swap the update statement like:
IF (status =1) OR (status =2)--What status is doing here? From where it came? Get the value for it from your table.
BEGIN 
	UPDATE issuesdetails SET assignedto=@employeeid,status =2 , testerassign=@testerid WHERE issuetrackerid=@issuetrackerid
END
ELSE
BEGIN
	UPDATE issuesdetails SET assignedto = @employeeid , testerassign=@testerid WHERE issuetrackerid=@issuetrackerid
END







--Amit




--Amit


这篇关于更新程序问题中的查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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