2、查询后再赋值    
  if exists 
   (select client_Code,max(dealdate),Employee_Code1 
    from t_tend_info
    where year(dealdate)=cast(@year as int)
    and flag='T'
    and Client_Code=@Client_Code
    group by client_Code,Employee_Code1)
begin
    select @Last_Come_Date=max(dealdate),@Last_Employee_Code=Employee_Code1 
    from t_tend_info
    where year(dealdate)=cast(@year as int)
    and flag='T'
    and Client_Code=@Client_Code
    group by client_Code,Employee_Code1
    执行语句
end