declare @ID bigint
if exists (select @ID=ID
from dbo.T_D_TA_WareHouseIn
where
MakerItemCD=@MakerItemCD and
Amount=@Amount and
MakeDate=@MakeDate and
BoxNo=@BoxNo and
UseFlag=' ')
为什么加上@ID就不对呢,赋值的时候不能和exists共用还是怎么回事啊,帮帮忙啊
...全文
2414打赏收藏
sql高手请进~~~(exists和赋值的问题)
declare @ID bigint if exists (select @ID=ID from dbo.T_D_TA_WareHouseIn where MakerItemCD=@MakerItemCD and Amount=@Amount and MakeDate=@MakeDate and BoxNo=@BoxNo and UseFlag=' ') 为什么加上@ID就不对呢,赋值的时候不能和exists共用还是怎么回事啊,帮帮忙啊
declare @ID bigint
select @ID=ID
from dbo.T_D_TA_WareHouseIn
where
MakerItemCD=@MakerItemCD and
Amount=@Amount and
MakeDate=@MakeDate and
BoxNo=@BoxNo and
UseFlag=' ')
if @ID is null then print '不存在' else print cast(@ID as varchar)