MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SQL- Fetch

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
vani
Beginner


Joined: 28 May 2003
Posts: 51
Topics: 30

PostPosted: Wed Sep 03, 2003 11:58 pm    Post subject: SQL- Fetch Reply with quote

I want to know how to retrieve first 100 rows from a table in DB2 ver6.
Because FETCH is not working in DB2 Ver 6.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12382
Topics: 75
Location: San Jose

PostPosted: Thu Sep 04, 2003 5:27 am    Post subject: Reply with quote

vani,

If you want to do this programmatically, declare cursor and fetch it for 100 times.
If it is via spufi, you can change the defualts,(max lines) to 100, so that it will display only 100 rows

In Qmf you can use the verb ROWLIMIT=100, so that you can get only 100 records

Also you can try this query even though I would not recommend it

Code:

SELECT COL1
       ,COL2
       ...
  FROM TABLE A
 WHERE 100 > (SELECT COUNT(*)
                FROM TABLE B
                WHERE A.PRIMARY KEY < B.PRIMARY KEY)


Hope this helps..

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group