请加大家一个问题,我在t1中找IFlg字段,当IFlg值为1或者2时,@flg设定为1,否则@flg设定为0,
最后把@flg做为返回值返回到调用此存储过程处。
请问像我这样写对不对?请各位高手指教!!!
谢了!!
begin
declare @i varchar(10)
declare @flg int
   select @i = IFlg 
   from Table1 t1, Table2 t2
   where t2.AcctMnc = @customerAccount
   and   t2.BC = t1.BC
   and   t2.AC = t1.AC
   
   if(@i = '1' || @i = '2')
      set @flg = 1   else
      set @flg = 0
      
   select @flg flg
     
end
go