Results 1 to 4 of 4

Thread: Sort Data

  1. #1
    Join Date
    Sep 2009
    Posts
    6

    Unanswered: Sort Data

    Hello Friends,
    I have written a sql query to bring the output in unix.
    The query is :
    select tabname,tabschema,colname from syscat.columns where typename='date' and colname like '%date%'"

    I am trying to place this output in excel sheet and there are some 1500 rows I have ,all of which are unsorted.

    Can anybody suggest or tune the query so that the output is in an organised manner?

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    select tabschema, tabname, colname
    from syscat.columns
    where typename= 'DATE' and colname like '%DATE%'
    order by tabschema, tabname, colno


    I assume you used caps for the literals instead of the lc in your post.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  3. #3
    Join Date
    Sep 2009
    Posts
    6
    Thanks Marcus

    But when I export this data into an excel sheet I see lot of spaces.I have like
    1500+ rows and I am trying to have the data like a table in excel sheet.Will the query you suggested give me the desired result?

  4. #4
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    db2 "export to date_column.txt of del select tabschema, tabname, colname from syscat.columns where typename= 'DATE' and colname like '%DATE%' order by tabschema, tabname, colno"

    Then open date_column.txt with Excel (you have to select txt files as input), and select "space" as the delimiter.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

Posting Permissions

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