在存储过程中怎样判断一个表中字段的值?
比如我现在想在一个存储过程中判断A表的B字段值如果 <0则退出这个存储过程不再往下执行,如果〉0则-1
------解决方案--------------------create proc test (@name varchar(2)) 
 as 
 if exists(select 1 from a where b <0 and name=@name) 
 print  'b小于0 ' 
 else  
 print -1 
------解决方案--------------------select @a=b from a 
 if @a> 1 
 ....
------解决方案--------------------A表的B字段值如果 <0 
 create procedure protest 
 @where varchar(50) 
 as  
 declare @b int 
 select @b=b from a where a.col=@where--此处的b必须为单条记录 
 case when @b <0 
 then 
 return 
 else 
 update a set b = b-1 where a.col=@where 
 end   
 go