473,508 Members | 2,475 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

limiting number of rows returned by resultset

Hi;
In db2 8.2, how do I limit a query resultset to x rows?

Thanks,
nat
Mar 29 '06 #1
3 3155
natG wrote:
In db2 8.2, how do I limit a query resultset to x rows?


.... FETCH FIRST xx ROWS ONLY

Bernd
Mar 29 '06 #2
Bernd Hohmann wrote:
natG wrote:
In db2 8.2, how do I limit a query resultset to x rows?

... FETCH FIRST xx ROWS ONLY

Bernd


If you intend to use this often, against large tables, consider also using:

... OPTIMIZE FOR xx ROWS
There's a good overview in the section: Guidelines for restricting select statements at:

http://publib.boulder.ibm.com/infoce...n/c0005280.htm
Eric
Mar 30 '06 #3
On Thu, 30 Mar 2006 10:11:32 +0200, Eric.Jones wrote:
Bernd Hohmann wrote:
natG wrote:
In db2 8.2, how do I limit a query resultset to x rows?

... FETCH FIRST xx ROWS ONLY

Bernd


If you intend to use this often, against large tables, consider also using:

... OPTIMIZE FOR xx ROWS
There's a good overview in the section: Guidelines for restricting select statements at:

http://publib.boulder.ibm.com/infoce...n/c0005280.htm
Eric


Thank you much.
nat

Mar 30 '06 #4

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

Similar topics

4
11179
by: dekern | last post by:
I have been trying to set the default text value of a TextArea element for about a day now without any luck. Similar to the code used to set the Text field below I would like to use the returned...
19
81747
by: xixi | last post by:
i want to use sql query to open a resultset, say i want the cursor point to whatever position i start with by giving a row number , so is there anyway i can use the sql function to do that, so...
1
13408
by: BF | last post by:
Hello, I am trying to find out if there is a way to limit the number of rows returned when a cursor is opened. I am using DB2 version 7 on z/OS. The SELECT statement in my DECLARE CURSOR...
1
1041
by: Clay Beatty | last post by:
OK, I am a .Net newbie... and I'm sure that if I spend the next two weeks pouring through MSDN articles, I will find the answer... But... I'm sure that this is done all the time, and so I'm sure...
3
1468
by: Sonnich | last post by:
Hi! How do I limit the amount of returned rows? Lets say, that I want only the latest 400 rows (of e.g. 4034634 rows) - is there a parameter for that like rownum in Oracle? e.g. select *...
8
2670
by: Alec MacLean | last post by:
Hi, I'm using the DAAB Ent Lib (Jan 2006) for .NET 2.0, with VS 2005 Pro. My project is a Web app project (using the WAP add in). Background: I'm creating a survey system for our company, for...
1
2553
by: deepavsd | last post by:
Hi Am using MySQL and tring to get number of rows which is presented in ResultSet in JSP help me plz deepa
15
1760
by: Hexman | last post by:
Hello All, How do I limit the number of detail records selected in a Master-Detail set using SQL? I want to select all master records for a date, but only the first 3 records for the details...
1
1166
by: bfountain | last post by:
I have a query which someone wrote in Access and I have been charged with the task of making it work in SQL Server. The query runs fine, but the problem is that I need to get back only 3 records as...
0
7231
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
7133
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
7504
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5643
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4724
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
3214
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
3198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1568
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 ...
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.