Results 1 to 2 of 2

Thread: Row number

  1. #1
    Join Date
    May 2012
    Posts
    3

    Unanswered: Row number

    Hi !

    I have a table where it has got some 10 million records..

    I need to migrate the table to some other envirorment where am planning to read 50000 by 50000 records..

    I need to know whether if there is any function like row num where i can filter first 50000 records , then next 50000 so on till the records are completely committed.

  2. #2
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    1,126
    Use the function RID(tblname).
    So something like:

    SELECT MAX(RID(mytable))
    FROM mytable
    ORDER BY RID(mytable))
    FETCH FIRST 50000 ROWS ONLY
    ;
    -- store returned value, and use it in next query:
    SELECT * FROM mytable
    WHERE RID(mytable) <= 'stored value'

    (Or use "BETWEEN" instead of "<=" for subsequent windows.)
    --_Peter Vanroose,
    __IBM Certified Database Administrator, DB2 9 for z/OS
    __IBM Certified Application Developer
    __ABIS Training and Consulting
    __http://www.abis.be/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •