sql 查询时加入行号

2005及以后版本

select ROW_NUMBER()Over(ORDER BY UserID)  as rowId,UserID,UserName from  Users

 

2000版本

select    identity(int,1,1)   as   rowId, *   into   #tem  from  Users

select *   from   #tem 

drop   table   #tem

你可能感兴趣的:(sql)