[ACCEPTED]-What is the Equivalent syntax of mysql " LIMIT " clause in SQL Server-limit
Accepted answer
The closest thing is TOP:
Select top 5 * from tablename
You can get a range 1 ( rows 5 - 10)
SELECT * FROM (
SELECT TOP n * FROM (
SELECT TOP z columns -- (z=n+skip)
FROM tablename
ORDER BY key ASC
)
)
The closest to it is SELECT TOP X
but it is only equivalent 4 to LIMIT X
.
For LIMIT X, Y
, there is no direct MS-SQL equivalent 3 (as far as I know). Christian's solution 2 is a good one though.
MSSQL2005 (onwards) has 1 the ROW_NUMBER syntax which might be useful:
http://msdn.microsoft.com/en-us/library/ms186734%28SQL.90%29.aspx
cont=until desired number is starting to 3 get results limit=Want to see how many variables
SELECT 2 TOP (limit) cve_persona FROM persona WHERE 1 (cve_persona > cont)
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.