1,
select cast(identity(int,1,1) as int) as 序号,name into #temp from table
select * from #temp2,select * from #temp where 序号=N

解决方案 »

  1.   

    alter table test add newid int identity(1,1)
    1:
    select newid as 序号,name from test
    2:
    select name from test where newid=n
    alter table test drop column newid
      

  2.   

    不要加临时表和字段就通过SQL语句能够实现吗?我们的系统里的表已经用了好长时间了,不大好变动了呀!最好用一条语句
      

  3.   

    在查询分析器里,select * from name,会自动显示序号。而且达到这样的效果没有很大的意义