250 pts.
 SELECT with LIMIT in AS/400
Hi all,

On my AS400, I need to select the first 90 records from one file and insert them into another file, but all the time i got all records in my result file. Is there any way to use the parameter LIMIT with my SQL SELECT

INSERT INTO LIB1/FILE1 (FILE1) SELECT DISTINCT                  (substring(FILE1, 1, 100)) FROM FILE1 WHERE FILE1 like '%xxxx%'  

thank you



Software/Hardware used:
AS400
ASKED: June 13, 2011  6:40 PM
UPDATED: June 14, 2011  4:19 PM
  Help
 Approved Answer - Chosen by carlosdl

Try using the fetch-first-clause as in FETCH FIRST 90 ROWS ONLY. Although the link is for i 7.1 DB2, the clause should work in any current release.

Tom

ANSWERED:  Jun 14, 2011  6:41 AM (GMT)  by carlosdl

 
Other Answers:
Last Wiki Answer Submitted:  June 27, 2012  4:11 am  by    0 pts.
Latest Answer Wiki Contributors: 
To see other answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

All the time you have an answer…thanks a lot Tom
you are an IT god loool

 250 pts.