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 > Cant move columns

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-15-09, 09:17
Dosihris Dosihris is offline
Registered User
 
Join Date: Aug 2009
Posts: 9
Cant move columns

Hi, i use DB2 and i have created some tables. now i was "finished" but i forgot a column. i have added the last column and i wanted to move it up. there are zwo buttons to move columns up and down, but they are disabled. does andybody know, what i have to do to enable them???

Nic
Reply With Quote
  #2 (permalink)  
Old 08-15-09, 10:07
Stealth_DBA Stealth_DBA is offline
Registered User
 
Join Date: May 2009
Posts: 472
Dosihris, The buttons are are disabled because you are not allowed to rearrange the columns of an already existing table. If you want to put the column in the 'middle' of existing columns you will have to drop and recreate the table (along with exporting / loading any data, recreating indexes, primary and foreign keys, etc.).

The Up and Down arrows are enabled when you are creating a new table. Since the physical object doesn't exist yet, you can rearrange columns however you want.
Reply With Quote
  #3 (permalink)  
Old 08-15-09, 10:41
Dosihris Dosihris is offline
Registered User
 
Join Date: Aug 2009
Posts: 9
ah, thanks for the answer... but why is it soo hard to change a column in the database??? Microsoft SQL can it too... Now i'm in the design phase, but when there are data in my table, i can not drop everything... there are foreign keys and i would have to create the entire database again.. because of one column... that would be stupid...
Reply With Quote
  #4 (permalink)  
Old 08-15-09, 12:55
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
why do you want to change the column sequence. this has no importance at all
it is not because some other can do this, that they are superior. there are millions of things that db2 can do, that others can not
you can add-drop a column, but I don't see any reason for moving a column in the sequence.Planning is the most important part of a db.
__________________
Best Regards, Guy Przytula
Database Software Consultant
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
  #5 (permalink)  
Old 08-15-09, 14:38
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
The actual physical order of the columns in the row is not the same as the logical order anyway. Db2 LUW will automaticlly put VARCHAR's at the end (at least when table is initially created).
__________________
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
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