0

How to use LIMIT function in SQL Server?

I need to create a pagination using SQL Server data and I need to fetch the data using $start and $pagesize.

This is the query used:

  SELECT * 
  FROM Customers 
  LIMIT $start, $pagesize;
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Senthilkumar
  • 100
  • 3
  • 16

1 Answers1

0

use this query

select * from (
SELECT  *,ROW_NUMBER() OVER ( ORDER BY az135 desc ) AS RowNum
FROM    ( SELECT     az13 FROM a12 WHERE   (az133 = '**') ) AS RowConstrainedResult )as a WHERE   RowNum >= 10 AND RowNum <= 20
user1667845
  • 57
  • 1
  • 10