how to use Limit in Sql server

Go4Expert Member
9Apr2008,22:09   #1
prabhat1's Avatar
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..........
Go4Expert Member
20Nov2009,00:27   #2
sql-programs's Avatar
Sql Server does not have a LIMIT functionality. You can use TOP.

Code:
select TOP 5 * from Table1
Contributor
16Dec2009,00:39   #3
urstop's Avatar
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.