View previous topic :: View next topic
|
Author |
Message |
kutty.r
New User
Joined: 22 Jun 2006 Posts: 24
|
|
|
|
Hi All,
I need to remove a column from the database table .I am am trying to execute the below mentioned query and ending with an error
SQLSTATE :42601
ALTER TABLE D$TEST.ETEGTTTT DROP COLUMN TTTT_DROP;
Note: could you please suggest any other query for removing a column from DB2 tables?
Thanks! |
|
Back to top |
|
|
vini_srcna
Active User
Joined: 26 May 2005 Posts: 178 Location: Copenhagen, Denmark
|
|
|
|
Drop the table and recreate it without that column. Make sure the you unload the data before dropping it. You can later load the data. |
|
Back to top |
|
|
sri_mf
Active User
Joined: 31 Aug 2006 Posts: 218 Location: India
|
|
|
|
vini_srcna wrote: |
Drop the table and recreate it without that column. Make sure the you unload the data before dropping it. You can later load the data. |
Vini,
I think this is what you mean.
1.Unload the file.
2.Reformat the unloaded file.
3.Use the New reformatted file for loading the New table.
Correct me if i misunderstand you. |
|
Back to top |
|
|
vini_srcna
Active User
Joined: 26 May 2005 Posts: 178 Location: Copenhagen, Denmark
|
|
|
|
Sri,
You have got it right.!. I would do
1. Unload the data into a file without that column. In the SQL query I would not give the column name that needs to be dropped. This way we dont need to reformat the data.
2. Drop the table and recreate it.
3. Load the data. |
|
Back to top |
|
|
vini_srcna
Active User
Joined: 26 May 2005 Posts: 178 Location: Copenhagen, Denmark
|
|
|
|
Ofcourse there are very good tools that they do all this process by themselves. All you have to do is to issue few commands. |
|
Back to top |
|
|
sri_mf
Active User
Joined: 31 Aug 2006 Posts: 218 Location: India
|
|
|
|
vini_srcna wrote: |
Ofcourse there are very good tools that they do all this process by themselves. All you have to do is to issue few commands. |
Thank you Vini |
|
Back to top |
|
|
vini_srcna
Active User
Joined: 26 May 2005 Posts: 178 Location: Copenhagen, Denmark
|
|
|
|
You are welcome. |
|
Back to top |
|
|
|