Row Offset in SQL Server

后端 未结 16 2406
醉酒成梦
醉酒成梦 2020-11-22 05:53

Is there any way in SQL Server to get the results starting at a given offset? For example, in another type of SQL database, it\'s possible to do:

SELECT * FR         


        
16条回答
  •  灰色年华
    2020-11-22 06:14

    Best way to do it without wasting time to order records is like this :

    select 0 as tmp,Column1 from Table1 Order by tmp OFFSET 5000000 ROWS FETCH NEXT 50 ROWS ONLY
    

    it takes less than one second!
    best solution for large tables.

提交回复
热议问题