Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2005
    Posts
    6

    Unanswered: The list columns in SYSCAT.COLUMNS is sometime in the wrong order.

    Hi All,

    I hava a problem when I use this statement:

    SELECT COLNAME , TYPENAME, LENGTH, SCALE, IDENTITY, KEYSEQ FROM SYSCAT.COLUMNS WHERE TABNAME = 'MYTABLE';

    using C# to get the list result but sometime The list columns in SYSCAT.COLUMNS of table MYTABLE is in the wrong order.

    Can you tell me why and please show the way to get The list columns in right order .

    My table like this : F1(PK), F2, F3, F4 ----> and The list columns that I get by C# is: F1, F4, F3, F2.

    Please help me.
    Thanks and sorry for my poor English.
    Rock.

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Any time you use SQL and want the rows returned in a specific order, you must use the ORDER BY clause. Even if you don't think you need it, there is no guarantee that the rows will be returned in the same order as a previous execution of a query, unless you have the ORDER BY statement.
    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 2005
    Posts
    6

    Thank you Marcus_A

    Thank you Marcus_A, now I use "ORDER BY COLNO" ---> It works well.

    Have a nice day!!!
    Last edited by hsrock; 12-07-05 at 02:41.

Posting Permissions

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