473,467 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how to specify the number of records to fetch

hi
can any body helps me for the equal statement at DB2 ver 7.0 for this
statement at SQL?
Select top 10 column1 from table1
thanks
Nov 12 '05 #1
7 10801
to get the first 10 rows......

select column1 from table1 fetch first 10 rows only

to get the top 10 rows........

select column1 from table1 order by column1 desc fetch first 10 rows
only

Graham Martin
http://www.ibm.com/software/data/db2/migration/

Nov 12 '05 #2
romina wrote:
can any body helps me for the equal statement at DB2 ver 7.0 for this
statement at SQL?
Select top 10 column1 from table1


SELECT * FROM table WHERE xxx ORDER BY yyy ASC FETCH FIRST 10 ROWS ONLY

Bernd

--
"Ja, alles meine Herren" sprach Fürst Lichnowsky. "Ooch det roochen?"
"Ja, auch das Rauchen." "Ooch im Tiergarten?" "Ja, auch im Tiergarten
darf geraucht werden, meine Herren." Und so endeten die Barrikadenkämpfe
des 18. März in Berlin
Nov 12 '05 #3
romina wrote:
hi
can any body helps me for the equal statement at DB2 ver 7.0 for this
statement at SQL?
Select top 10 column1 from table1


Have a look at the DB2 manual, specifically here:
http://publib.boulder.ibm.com/infoce...n/r0000875.htm

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Nov 12 '05 #4
hi ,
tanks for ur help,I did it but this error happened:

ILLEGAL USE OF KEYWORD FETCH, TOKEN , FOR WITH QUERYNO OPTIMIZE WAS EXPECTED

I don't know why!

--
Message posted via DBMonster.com
http://www.dbmonster.com/Uwe/Forums....m-db2/200511/1
Nov 12 '05 #5
In article <573f8d3305960@uwe>, romina via DBMonster.com (u15590@uwe)
says...
hi ,
tanks for ur help,I did it but this error happened:

ILLEGAL USE OF KEYWORD FETCH, TOKEN , FOR WITH QUERYNO OPTIMIZE WAS EXPECTED

I don't know why!


Which DB2 do you use, DB2 v7.0 on mainframe?
Nov 12 '05 #6
hi
it's DB2 v6.0 on mainframe
Gert van der Kooij wrote:
hi ,
tanks for ur help,I did it but this error happened:

ILLEGAL USE OF KEYWORD FETCH, TOKEN , FOR WITH QUERYNO OPTIMIZE WAS EXPECTED

I don't know why!


Which DB2 do you use, DB2 v7.0 on mainframe?


--
Message posted via DBMonster.com
http://www.dbmonster.com/Uwe/Forums....m-db2/200511/1
Nov 16 '05 #7
hi
it's DB2 v6.0 on mainframe
Gert van der Kooij wrote:
hi ,
tanks for ur help,I did it but this error happened:

ILLEGAL USE OF KEYWORD FETCH, TOKEN , FOR WITH QUERYNO OPTIMIZE WAS EXPECTED

I don't know why!


Which DB2 do you use, DB2 v7.0 on mainframe?


--
Message posted via DBMonster.com
http://www.dbmonster.com/Uwe/Forums....m-db2/200511/1
Nov 16 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Beelzehubub | last post by:
Hi, I'm having a bit of trouble with an update performed by a PL/SQL routine that is updating more rows than it should be. Here's some of the code: Note that ZENT.APPID is NUMBER and ZENT.UCLS...
2
by: eeh | last post by:
Hi, Suppose I have a table "product" with fields id,name,price. I want to get a resultset of previous and current and next record when the resultset is sorted by id and id=10. The table data is...
8
by: John Baker | last post by:
Hi: Access 2000 W98! I have a table with numerous records in it, and am attempting to delete certain records that have been selected from it. These are selected based on the ID number in a...
3
by: Christoffer Gurell | last post by:
After declaring a cursor. Is there any way you can check the number of rows that cursor contains ?? / Christoffer Gurell ---------------------------(end of...
5
by: alingsjtu | last post by:
Hello, every body. When execute dynamic generated multiple OPENQUERY statements (which linkes to DB2) in SQLServer, I always got SQL1040N The maximum number of applications is already connected...
4
by: ssrirao | last post by:
Table1 -------------------------------------------------------- a(varchar) | b(varchar) | c(varchar) | d(float) --------------------------------------------------------- has value...
4
by: muskan | last post by:
hello, I want to fetch all the records from database one by one when I click on next button I have written this code for fetching the records from database. But it shows only first record....
4
by: indhu | last post by:
hi all, Tables: story, shot story-fieldnames, project, date episode shot-fieldnames, scene,shot, filename(imagepath),action and dialogue. Form has field from both the tables. how do i fetch...
3
by: camarun20 | last post by:
Hi , I constructed an MS access query in java to retrieve the rows in random. The code snipet Connection con = DriverManager.getConnection( database ,"",""); Statement s =...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.