February 22, 2008 at 7:52 am
Hi
I am currently having to delete some data from a table with six million rows.I need to delete columns 1,2,3,5, and 7 but leave the structure in forma ll tables and the data for columns 4,6,8,9,10.
I#m updating the fields one by one this is taking a long time. Is there a quicker way to do this?
Thanks.
Nick
February 22, 2008 at 8:17 am
but leave the structure in forma ll tables and the data for columns 4,6,8,9,10.
I am not quite sure what you are asking for. You can drop columns by using the alter table statement. Note that you must delete any constraints that exist on a column before dropping.
ALTER TABLE MYTABLE
DROP COLUMN TEST,
TEST2,
TEST3
February 22, 2008 at 8:25 am
Adam,
Thanks for the reply. I need to keep the structure but set all the data in some columns to null whilst leaving the data in other columns
Nick
February 22, 2008 at 8:49 am
Ah, so you just need to make the data in columns 1,2,3,5, and 7 null.
UPDATE TABLENAME
SET COL1 = NULL,
COL2 = NULL,
COL3 = NULL,
COL5 = NULL,
COL7 = NULL
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply