how to use Limit in Sql server

prabhat1's Avatar, Join Date: Mar 2008
Go4Expert Member
hiiiiiiii.......... i want to use limit in my query to show only few items from database.

For example i have ..10 values in my table but at a time i want to retrieve only 5 at a time

The LIMIT works well in My SQL but not in SQL server

please gve me the sample query.......

thanks in advance..........

prabhat..........
0
sql-programs's Avatar, Join Date: Oct 2009
Go4Expert Member
Sql Server does not have a LIMIT functionality. You can use TOP.

Code:
select TOP 5 * from Table1
0
urstop's Avatar, Join Date: Oct 2007
Contributor
You can use TOP to get the required number of records from the starting position in the result set, but there is no direct way to get records from a specific position as we have with LIMIT.