SQL Server 得到行号的SQL

使用临时表:

select   id=identity(int,1,1),value   into   #temp   from   YourTable  
  select   *   from   #temp  
  drop   table   #temp  

 

取得第11到20行记录:

select   IDENTITY(int,   1,1)   AS   ID_Num,*   into   #temp   from   表  
  select   *   from   #temp   where   ID_Num>10   and   ID_Num<=20

 

或  
  SELECT   Top   @PageSize   *  
            FROM   T  
          WHERE   SortField   NOT   IN   (SELECT   TOP   @PageSize   *   @Pagei   SortField  
                                                              FROM   T  
                                                      ORDER   BY   SortField  
                                                          )  
    ORDER   BY   SortField

 

REF:http://topic.csdn.net/t/20021022/21/1116380.html

 

相关文章

SELECT a.*,b.dp_name,c.pa_name,fm_name=(CASE WHEN a.fm_n...
if not exists(select name from syscolumns where name=&am...
select a.*,pano=a.pa_no,b.pa_name,f.dp_name,e.fw_state_n...
要在 SQL Server 2019 中设置定时自动重启,可以使用 Window...
您收到的错误消息表明数据库 &#39;EastRiver&#39; 的...
首先我需要查询出需要使用SQL Server Profiler跟踪的数据库标...