update t1 set t1.任课老师ID=t2.任课老师ID
from A表 t1
inner join 表B t2 on t1.学生ID=t2.学生ID