select identity(1,1) row,columnname into #temp_table from tablename
select * from #temp_table
drop table #temp_tale

解决方案 »

  1.   

    select row=identity(int,1,1),ColumnName into #t from TableNameselect * from #tdrop table #t
      

  2.   

    My God!~!
    寫錯了!
    原意是:
    "
    我不想用 #temptable
    "
      

  3.   

    在原表加一字段
    atler table add row int identity(1,1)
      

  4.   

    select row=identity(int,1,1),ColumnName into #temptable from TableNameselect * from #temptable
      

  5.   

    --如果有主键,还可以这样处理select row=(select count(*) from tablename where 主键<=a.主键),ColumnName
    from tablename a