Home » SQL & PL/SQL » SQL & PL/SQL » how to delete several columns in a table?
how to delete several columns in a table? [message #1832] Mon, 03 June 2002 08:56 Go to next message
amber
Messages: 4
Registered: March 2001
Junior Member
I added 2 columns by accident, how do I delete them?
Re: how to delete several columns in a table? [message #1833 is a reply to message #1832] Mon, 03 June 2002 09:19 Go to previous message
ckr
Messages: 13
Registered: May 2002
Junior Member
u can copy the table with only the columns u want into a new table from the old table.drop the old table .and rename the new table with oldtable name

let's say u are creating a table named new_table from the old_table with only the columns u want like.


create table new_table as
select column1,column2,column3 from old _table;

now after the table is created.drop the old_table

drop table old_table;

then rename the new_table as old_table;

rename new_table to old_table;

hope this solves your problem.
Previous Topic: Using Variables in Cursors
Next Topic: Re: Find Numbers
Goto Forum:
  


Current Time: Fri Apr 26 12:22:40 CDT 2024