日期:2014-05-18 浏览次数:20496 次
declare @priorrodno varchar(50) declare @priorstate varchar(50) select top 1 @priorrodno=rodno,@priorstate=state from PRO_Priorflow where flowprocess='脱气' and left(state,1)='P' order by state if (@@ROWCOUNT>0) begin if(@priorrodno in('A03P0058','A10R0078','A08R0107','A06P0040','A01P0317','A05R0126','A02P0308')) begin print 'a' end end
declare @dd varchar(32)='ds' if @dd in('sasd','3sf','343','ds') begin print 1 end else begin print 2 end /*1*/
------解决方案--------------------
有可能就 没有走到你的 if (@@ROWCOUNT>0) 这个分支就。
if (@@ROWCOUNT>0) begin if(@priorrodno in('A03P0058','A10R0078','A08R0107','A06P0040','A01P0317','A05R0126','A02P0308')) begin print 'a' end else begin print 'b' end end else begin print '11' end 这样写看看走到那个分支了