假设表有主键ID列,以下生成比原表多一个序号列并按ID号大小填充的新表。select 序号=(select count(1) from tablename a where a.id>=tablename.id),* from tablename
select identity(int,1,1) as x ,* insert into newtbfrom oldtb
用ROW_NUMBER() over(order by 排序列 asc) 不就可以了?