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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Select question

Author  Topic 

Mazdak
Yak Posting Veteran

63 Posts

Posted - 2002-12-27 : 04:10:30
I want to query records from number 40 to 50 for example.I have an identity field that increase by 1 but also user may delete records so some records may not exist,so I need to query fourth 10 records.How it is possible?

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2002-12-27 : 05:11:00
I remember seeing a solution for this kind of query sometime ago here on the forums. It was something like:

SELECT TOP 10 * FROM tableName WHERE IDCol NOT IN
(SELECT TOP 40 IDCol FROM tableName ORDER BY IDCol)
ORDER BY IDCol

Vyas also has a section on his website [url]http://vyaskn.tripod.com[/url]

OS
=================================================================
I started out with nothing. Still have most of it left.

Go to Top of Page
   

- Advertisement -