Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

offset and limit in mssql?

Status
Not open for further replies.

mrdance

Programmer
Apr 17, 2001
308
SE
In mysql you can specify the startposition of the result as the offset and limit as the number of rows to be returned. For example;

SELECT * FROM TABLE LIMIT $offset, $limit

How do I do it in MSSQL?

Thanks / Henrik
 
Hi There

To limit the amount of records returned in mssql you can
use the Top keyword.

To Select the top 10 records from a table
-----------------------------------------
Select Top 10 * From mytable


To Select the top 10 Percent of records from a table
----------------------------------------------------
Select Top 10 PERCENT * From mytable


I am not sure about the starting position .

Hope this helps
Bernadette
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top