Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-04-19 : 08:53:04
|
| Adrian writes "I have a query that selects all records from a table. The recordset is about 1000 records, how would I write a query to selct rows 200-210? Is there anyway that I can limit the recordset?" |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2002-04-19 : 09:19:08
|
| search for "What's After Top".....should give you an appropriate solution. |
 |
|
|
Nazim
A custom title
1408 Posts |
Posted - 2002-04-20 : 02:05:27
|
| Andrew was referring to Article search.Herez the actual link http://www.sqlteam.com/item.asp?ItemID=566 .--------------------------------------------------------------Edited by - Nazim on 04/24/2002 00:45:43 |
 |
|
|
rrb
SQLTeam Poet Laureate
1479 Posts |
Posted - 2002-04-23 : 20:12:22
|
AdrianCreate a temp table (or a table variable table thingy) which has them in order, with a new id field. This will then have all your records with a rownumber.egassuming your table has a unique column id called "id"create table #ordered (temprownum int identity(1,1), colid int)insert into #ordered (colid)select idfrom mytableorder by (whatever you want to order by)then you can select whichever rows you want, egselect b.* from #ordered a inner join mytable b on a.colid = b.idwhere a.temprownum > 200 and a.temprownum < 210Oh, and don't forget to drop table #orderedHTH --I hope that when I die someone will say of me "That guy sure owed me a lot of money" |
 |
|
|
|
|
|