update @temp_in   set existflag=10 from @hospitaluse as  t1
where psrcode=t1.psrcode and hospitalcode=t1.hospitalcode and goodscode=t1.goodscode 
and year=t1.year and month=t1.month---------->update t2   set existflag=10 from @hospitaluse as  t1,@temp_in as t2
where t2.psrcode=t1.psrcode and t2.hospitalcode=t1.hospitalcode and t2.goodscode=t1.goodscode 
and t2.[year]=t1.[year] and t2.[month]=t1.[month]