用Select IDENTITY(int, 1, 1),name,birth 
Into tmptable from table
生成一个临时表。
然后再
Select * from tmptable

解决方案 »

  1.   

    我也是用楼上的临时表方法
    learn
      

  2.   

    不能在服务器端生成视图或是须表是不是你的SQL服务器有问题。
      

  3.   

    oracle中可以用rownum,sqlServer还真不知道,关注
      

  4.   

    select identity(int, 1, 1) as id,name,birth into #tempTable from table1select * from #tempTabledrop table #tempTable
      

  5.   

    你是用什么实现de?
    。net那可以在DataTable里加一列ID,赋值有自己控制!
      

  6.   

    只能是使用临时表吧。我现在还没有想到其它的方法。
    select identity(int, 1, 1) as lsh,name,birth into #temp from table1select * from #temp
      

  7.   

    在服务器端 select name ,birth from table1 后,在客户端再设法加 identity列。要是可行,服务器端的负荷能小一点。
      

  8.   

    你是一定要在SQL Server上生成这样的一个表吗?
    如果不是的话,先用原来的表填充DataSet,再加上一列就应该可以的。
      

  9.   

    用临时表的方法我也想过,也会做! 可是用临时表的话当数据超过两千条的时候会比普通的查询慢5—8倍,而用NOT IN的方法也会慢很多!另外DataSet确实可以添加ID,但还是那句话,当大数据量的时候,用DataSet是很消耗内存的,我公司每天的访问量有5000至6000,同时在线有时也会超过5000,所以我在每次取数据的时候我想根据这个ID每次取出少的部分进行分页!我只是想找一个好的方法,希望各位多提出好的建议!
      

  10.   

    晕啊,闹半天,原来是为了分页显示。MSDN里有现成的优化方法。