View previous topic :: View next topic |
Author |
Message |
yadav2005 Intermediate

Joined: 10 Jan 2005 Posts: 348 Topics: 144
|
Posted: Mon Aug 27, 2007 2:01 pm Post subject: unload first 10 rows only |
|
|
Members,
I am trying to unload records from a DB2 table using a query in JCL by executing Unload utility , but i am getting many records , however i want to restrict the unload to only first 10 rows only , can somebody help me with the query ?
one option would be to unload and then run a sort step to copy first 10 records using different ways but i would like to have it done by a sql query. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
yadav2005 Intermediate

Joined: 10 Jan 2005 Posts: 348 Topics: 144
|
Posted: Mon Aug 27, 2007 2:26 pm Post subject: |
|
|
Thanks Kolusu for your needful help it works .But i would like to have a WHERE condition included also in the query , if that is the case how should i use.
For example:
Code: |
SELECT *
FROM TABLE
FETCH FIRST 10 ROWS ONLY;
|
Now i want to include a condition where EMPAGE = 24 , how can i do that as i want to retreive first 10 employees whose EMPGAE = 24 years. |
|
Back to top |
|
 |
yadav2005 Intermediate

Joined: 10 Jan 2005 Posts: 348 Topics: 144
|
Posted: Mon Aug 27, 2007 2:27 pm Post subject: |
|
|
Kolusu,
I got the solution by trying:
Code: |
SELECT *
FROM TABLE
WHERE EMPAGE = 24
FETCH FIRST 10 ROWS ONLY;
|
|
|
Back to top |
|
 |
|
|