比如:
select col, col+1 as col_ from tbl
我希望有一个别名栏, 当我选择 n 条记录的时候, ID自增. 谢谢.

解决方案 »

  1.   

    select col,id=identity(int,1,1) into # from tbl
    select * from #
      

  2.   

    谢谢楼上的, 我希望能一个 select 语句搞定.
      

  3.   

    try:select id=(select count(*) from tbl where col<=t.col),col from tbl t
      

  4.   

    看看这个后面有个总结
    http://community.csdn.net/Expert/topic/4995/4995147.xml?temp=3.882998E-02
      

  5.   

    有效, 结帐...语句:
    select id_=(select count(*) from t where id<=tt.id),id from t tt