title: Return n number of rows from SQL Server query
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/187998/row-offset-in-sql-server">Row Offset in SQL Server</a>  </p>
  </blockquote>
  
  
  
  <p>I have a query which has a like condition and it returns around 1500 rows. Now I want to know how can I get the rows part by part, e.g. return 75 rows, then again the next 75 rows until it reaches the end of the rows. I know I can use something like <code>SELECT TOP 75</code></p>
  
  <p>I tried something like this but it does not return any rows</p>
  
  <pre><code>    SELECT * 
      FROM 
         (SELECT ROW_NUMBER() OVER (ORDER BY WarehouseSubType.id) as row,
                 WarehouseSubType.id, 
                 WarehouseType.name as WarehouseTypename,
                 WarehouseType.alternateName AS WarehouseTypealternateName,
                 WarehouseSubType.name AS WarehouseSubTypename,
                 Warehouse.alternateName AS WarehousealternateName,
                 WarehouseSubType.alternateName AS WarehouseSubTypealternateName,
                 WarehouseSubType1.name AS WarehouseSubType1name,
                 WarehouseSubType1.alternateName AS WarehouseSubType1alternateName,
                 Warehouse.alternateName AS Warehousename,
                 Branch.name AS Branchname,
                 Branch.alternateName AS BranchalternateName,
                 WarehouseProductQuantity.actualQuantity,
                 WarehouseProductQuantity.reservedQuantity,
                 Supplier.companyName, 
                 Supplier.companyNameAlternate,
                 Tafsil.description,
                 Tafsil.alternateDescription,
                  (WarehouseProductQuantity.actualQuantity - WarehouseProductQuantity.reservedQuantity) AS quantity 
          FROM WarehouseSubType 
          INNER JOIN WarehouseType ON (WarehouseSubType.warehouseTypeId = WarehouseType.id)
          INNER JOIN WarehouseSubType1 ON (WarehouseSubType.id = WarehouseSubType1.warehouseSubTypeId)
     ) a 
  WHERE 
      warehouseTypename like '%Ve%' 
      AND row &gt; 0 and row &lt; 75
  </code></pre>