Skip to main content
Inspiring
July 30, 2008
Question

Select in SQL server

  • July 30, 2008
  • 3 replies
  • 577 views
Can someone explain this ( Select TOP 40 * ) in plain english ?
This topic has been closed for replies.

3 replies

emmim44Author
Inspiring
July 30, 2008
Niceeee... Thank dudes.
emmim44Author
Inspiring
July 30, 2008
Niceeee... Thank dudes.
Inspiring
July 30, 2008
SELECT TOP 40 = select data from first 40 rows only

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Participating Frequently
July 30, 2008
SQL Server BOL is your friend.....

The TOP clause limits the number of rows returned in the result set.

TOP n [PERCENT]

n specifies how many rows are returned. If PERCENT is not specified, n is the number of rows to return. If PERCENT is specified, n is the percentage of the result set rows to return:

TOP 120 /*Return the top 120 rows of the result set. */
TOP 15 PERCENT /* Return the top 15% of the result set. */.

If a SELECT statement that includes TOP also has an ORDER BY clause, the rows to be returned are selected from the ordered result set. The entire result set is built in the specified order and the top n rows in the ordered result set are returned.


Phil