1:
Select *,identity(int,1,1) as id into #tmp from 表
Select * from #tmp2:
Select *,(Select sum(1) from 表 where 学号<= a.学号) as id
from 表 a
Select *,identity(int,1,1) as id into #tmp from 表
Select * from #tmp2:
Select *,(Select sum(1) from 表 where 学号<= a.学号) as id
from 表 a
from 学生学籍表 b
select * from #tempdrop table #temp