By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,017 Members | 951 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,017 IT Pros & Developers. It's quick & easy.

Deleting a column data from table

P: 7
Hi all,
I am trying to delete the data from only one column of a table. can any one help on this.......
Mar 7 '07 #1
Share this Question
Share on Google+
3 Replies

P: 24
Depends whether you mean you want to remove the column from the table altogether or just remove the date in the column,

If the column is CHAR then do something like this


This will set the column on all rows to an empty string.

If yuo want to remove a column from the table then that is a little more difficult. Depends on what utilities you have. I would unload the table to a file, drop the table and then redefine the table without the column. Then build a LOAD statement using the data from tbe unload but do not include a reference the values stored for the column you removed.

If you have a look in some of the DB2 reference guides they will show you the syntax for the LOAD statement, it basically requires you to supply the destination column name, the start position of the data in the file and the length of the field on the file. If you do not supply any column information on the load it assumes the data order, start points and field lengths are in line with structure of the destination table.

Hope that helps,

Mar 17 '07 #2

P: 1
update table_name
SET column = null
Dec 12 '11 #3

P: 1
Try this

ALTER TABLE table_name
DROP COLUMN column_name
Jan 1 '12 #4

Post your reply

Sign in to post your reply or Sign up for a free account.