Go4Expert

Go4Expert (http://www.go4expert.com/)
-   SQL Server (http://www.go4expert.com/forums/sql-server-forum/)
-   -   how to use Limit in Sql server (http://www.go4expert.com/forums/limit-sql-server-t9894/)

prabhat1 9Apr2008 22:09

how to use Limit in Sql server
 
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..........

sql-programs 20Nov2009 00:27

Re: how to use Limit in Sql server
 
Sql Server does not have a LIMIT functionality. You can use TOP.

Code:

select TOP 5 * from Table1

urstop 16Dec2009 00:39

Re: how to use Limit in Sql server
 
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.


All times are GMT +5.5. The time now is 14:17.