June 6, 2011 at 11:38 am
I just wanted to retrieve the first ten rows in the table. have been trying to use the Top clause but Im not getting the expected result.
Im a new baby using the SQL server 08.
June 6, 2011 at 11:42 am
Does your query also have an Order By clause? If not, Top can/will do strange things.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
June 6, 2011 at 11:59 am
SELECT TOP (10) <column list>
FROM <Some Table>
ORDER BY <Whatever columns defines the ordering you want>
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
June 6, 2011 at 3:29 pm
GilaMonster (6/6/2011)
SELECT TOP (10) <column list>
FROM <Some Table>
ORDER BY <Whatever columns defines the ordering you want>
Thanks it has been useful
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply