Withdata Software

The SQL Server equivalent for the MySQL Limit

In MySQL, you can use “Limit n,m”, like this:

select *
from sometable
order by name
limit 20,10

And in SQL Server, use this query:

SELECT *
FROM
(
      SELECT *,
        ROW_NUMBER() OVER (ORDER BY name) as rowNum
      FROM sometable
) sub
WHERE rowNum > 20
  AND rowNum <= 30

In Oracle: https://www.withdata.com/blog/oracle/how-to-limit-the-number-of-rows-returned-by-an-oracle-query-after-ordering.html .

In DB2: https://www.withdata.com/blog/db2/the-db2-equivalent-for-the-mysql-limit.html .

In Mysql: https://www.withdata.com/blog/mysql/how-to-limit-the-number-of-rows-returned-by-an-mysql-query.html .

In Sqite: https://www.withdata.com/blog/sqlite/how-to-limit-the-number-of-rows-returned-by-an-sqlite-query.html .

In PostgreSQL: https://www.withdata.com/blog/postgresql/how-to-limit-the-number-of-rows-returned-by-an-postgresql-query.html .

You can visit this page for more information: http://stackoverflow.com/questions/9261205/the-sql-server-equivalent-for-the-mysql-limit .

Some SQL Server tools you can try: https://www.withdata.com/sql-server/

Convert your data online, free

Free in-browser converters for CSV, Excel, JSON, XML and SQL: Withdata Online Data Conversion. Large files, batch conversion or scheduling? See the offline desktop apps, or browse all data conversion tools.