select id=identity(int),* into #t from 表B
select a.*,b.class,b.point
from 表A a
left join #t b on b.id=(select count(*) from 表A where code<=a.code)
drop table #t
select identity(int,1,1) as id ,* into #t1 from a
select identity(int,1,1) as id ,* into #t2 from b
select code, name, class, point from #t1 a left join #t2 b on a.id=b.id