我想更新SMSCAMID,如果它是null否则没有变化? [英] I want to update SMSCAMID if it was null else no change?

查看:61
本文介绍了我想更新SMSCAMID,如果它是null否则没有变化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里是我的代码,但它不起作用



Here my code but its not worked

ALTER proc [exeuser].[updateCampaignId]
@SMSText varchar(max)
as begin
declare @id int=(select ID from dbo.tblCampaignMaster 
where SMSTEXT=@SMSText)
 
update tblSMSSendData set  SMSCAMPID= case when SMSCAMPID is null then @id end where SMSTEXT=@SMSText 
end





我尝试过:





What I have tried:

ALTER proc [exeuser].[updateCampaignId]
@SMSText varchar(max)
as begin
declare @id int=(select ID from dbo.tblCampaignMaster 
where SMSTEXT=@SMSText)
 
update tblSMSSendData set  SMSCAMPID= case when SMSCAMPID is null then @id end where SMSTEXT=@SMSText 
end

推荐答案

试试这个



try this

update tblSMSSendData set  SMSCAMPID=  @id   where SMSTEXT=@SMSText and SMSCAMPID is null 


这篇关于我想更新SMSCAMID,如果它是null否则没有变化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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