错了
1,select * into #tmp from table
alter #tmp add cnt int identity(1,1)
select * from #tmp
2,要有一个可以唯一区分的列或列组合
select *,(select count(*) from table t2 where t2.id<=t.id) as cnt from table t
目前主要有2种方法
1,select * into #tmp from table
alter #tmp add cnt identity(1,1)
select * from #tmp
2,有一个可以唯一区分的列或列组合
select *,(select count(*) from table t2 where t2.id<=t.id) as cnt from table t