January 4, 2005 at 7:34 am
January 4, 2005 at 11:56 am
January 4, 2005 at 12:58 pm
Bear in mind that as stated, it will give you the first seven records it happens to find, in no particular order. Could be the first row inserted, 17th, 159th, etc. If you want to see them in a particular sequence, you must specify that sequence using an order by clause -
select top 7 * from table-name order by column_name
Steve
January 4, 2005 at 1:27 pm
Steve is absolutely right.
Order by __ ASC\DESC, where __ and even indexing etc. can all play a part depending upon how the table is set up and what the actual output requirement is.
The phrase x7 of x1000 suggested possible additional breakdowns so I kept it simple, anticipating further response.
January 4, 2005 at 1:37 pm
If this 7 is supposed to be dynamic, you might want to do something like
DECLARE @topnum INT
SET @topnum = 7
SET ROWCOUNT @topnum
SELECT FROM
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply