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
 General SQL Server Forums
 New to SQL Server Programming
 FETCH FIRST 20 ROWS ONLY

Author  Topic 

Tokajac
Starting Member

5 Posts

Posted - 2008-08-18 : 11:05:09
I'm using AS400, DB2


I have 1000 records in table and i want to read only 10 of them at a moment.
I found an example on:
http://www.ibm.com/developerworks/db2/library/techarticle/0307balani/0307balani.html

Example with FETCH FIRST 20 ROWS ONLY works, but ROW_NEXT BETWEEN 21 and 40 doesn't work.

Does anybody know how to write query similar to the example for
ROW_NEXT BETWEEN 21 and 40 doesn't ?


Regards

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2008-08-18 : 11:07:54
>>I'm using AS400, DB2
This is a MS Sql Server forum. I think you'll need to find a different forum unless you want to know how to do this using MS Sql Server :)

Be One with the Optimizer
TG
Go to Top of Page

Tokajac
Starting Member

5 Posts

Posted - 2008-08-18 : 11:30:50
MS SQL solution is welcome, too. Maybe i can use same (similar) query on AS400.
Sorry about the misplaced question.


Regards

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-18 : 11:39:48
MS SQL Server it will be like this

SELECT TOP 20 * FROM (SELECT TOP 40 * FROM YourTable ORDER BY PKCol)t ORDER BY PKCol DESC
Go to Top of Page
   

- Advertisement -