Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2014
    Posts
    294

    Unanswered: Row_number() in db2

    Hi,

    I am trying to use this ROW_NUMBER in db2 for insertion.This is working fine ,but in the output I am unable to find the row_id in ascending order.
    this is my query

    INSERT INTO FR (SELECT ROW_NUMBER() OVER(), A.SERVER as DB_NAME,A.CREATOR,A.TABLE_NAME,A.COLUMN_NAME,A.COL TYPE,A.NULLS,A.LENGTH,A.IDENTITY ,B.TABLE_COUNT
    FROM FR_STAGE A full OUTER JOIN M_ROWCOUNT B ON A.TABLE_NAME=B.TABLE_NAME )';

    can any one please let me know where should I mention the Order By clause for the ROWID.

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    how about select .. from table .. order by xx to produce the output
    order by 1 can also be used
    see doc for this basic detail...
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

Tags for this Thread

Posting Permissions

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