If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > The list columns in SYSCAT.COLUMNS is sometime in the wrong order.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-06-05, 23:28
hsrock hsrock is offline
Registered User
 
Join Date: Sep 2005
Posts: 6
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.
Reply With Quote
  #2 (permalink)  
Old 12-06-05, 23:51
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
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
Reply With Quote
  #3 (permalink)  
Old 12-07-05, 01:37
hsrock hsrock is offline
Registered User
 
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 01:41.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On