当前位置: 代码迷 >> Sql Server >> sql~(exists和赋值的有关问题)
  详细解决方案

sql~(exists和赋值的有关问题)

热度:60   发布时间:2016-04-27 16:41:23.0
sql高手请进~~~(exists和赋值的问题)
declare   @ID   bigint
if   exists   (select   @ID=ID
from   dbo.T_D_TA_WareHouseIn
where
[email protected]   and
[email protected]   and
[email protected]   and
[email protected]   and
UseFlag= '   ')
[email protected],赋值的时候不能和exists共用还是怎么回事啊,帮帮忙啊

------解决方案--------------------
declare @ID bigint
select @ID=ID
from dbo.T_D_TA_WareHouseIn
where
[email protected] and
[email protected] and
[email protected] and
[email protected] and
UseFlag= ' ')
if @ID is null then print '不存在 ' else print cast(@ID as varchar)
  相关解决方案