问题描述
- 求指点写的存储过程哪里有问题?
-
/*1、执行存储过程未更新任何数据: execute dbo.pro_alarm_update_qr @s_zyh ='00024893' , @dt_jyrq ='2016-1-9 22:52:8.653' , @s_yq ='血球仪BF6800' , @s_ybh ='2601094769' , @s_xmbh ='13' , @dt_sendtime ='2016-1-9 22:52:8.653' , @s_czybh ='9999 管理员' , @dt_qrsj ='2016-1-10 10:29:8.616' */ --过程内容: alter PROCEDURE [dbo].[pro_alarm_update_qr] @s_zyh varChar(20), @dt_jyrq DateTime, @s_yq varchar(10), @s_ybh varchar(20), @s_xmbh varchar(20), @dt_sendtime datetime, @s_czybh varchar(20), @dt_qrsj datetime AS update interface_lis_pacs..inter_lab_resultalert set hischeckman=@s_czybh,hischeckdt=@dt_qrsj where alertdt = @dt_jyrq and rptunitname=@s_yq and barcode=@s_ybh and rpt_itemid=@s_xmbh and alertdt = @dt_sendtime go ------------------------------------------------------------------------------- --2、把参数传进去,单独执行查询有数据,而且update也能够成功更新数据 select * -- update a set hischeckman=@s_czybh,hischeckdt=@dt_qrsj from interface_lis_pacs..inter_lab_resultalert a where alertdt = '2016-1-9 22:52:8.653' and rptunitname='血球仪BF6800' and barcode='2601094769' and rpt_itemid='13' and alertdt = '2016-1-9 22:52:8.653'
解决方案
楼主 你测试一下
--2、把参数传进去,单独执行查询有数据,而且update也能够成功更新数据
select * -- update a set hischeckman=@s_czybh,hischeckdt=@dt_qrsj
from interface_lis_pacs..inter_lab_resultalert a
where alertdt = '2016-1-9 22:52:8.653' and rptunitname='血球仪BF6800' and barcode='2601094769' and rpt_itemid='13' and alertdt = '2016-1-9 22:52:8.653'
把这段后面的where条件删除,看看能不能查询出数据
然后再把条件一个一个带入
解决方案二:
找到解决方法了:where alertdt = @dt_jyrq and rptunitname=@s_yq and barcode=@s_ybh and rpt_itemid=@s_xmbh and alertdt = @dt_sendtime
改成
where barcode=@s_ybh
就可以了
但是不知道原理,求高手告知原理……
解决方案三:
@s_yq varchar(10),
长度不够
时间: 2025-01-26 09:05:42