Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

changing a fieldname 1

Status
Not open for further replies.

jmannix

Programmer
Dec 18, 2003
10
0
0
US
I'd like to be able to change the name of a field that I added to a table. I know I can't delete and add a new one back, so I am hoping there is a way to re-name. Any help is appreciated. Thanks in advance.
 
The usual process is to create a new column with the name you want and "copy" the data from the old column to the new column, then drop the old column. The ALTER TABLE statement is what you need to be looking at.

-------------------------
The trouble with doing something right the first time is that noboby appreciates how difficult it was.
- Steven Wright
 
JMannix,

Yet another benefit of Oracle 9i (after you upgrade from 8i):
Code:
ALTER TABLE <table_name> RENAME COLUMN <old_name> TO <new_name>;

[santa]Mufasa
(aka Dave of Sandy, Utah, USA @ 22:21 (14Oct04) UTC (aka "GMT" and "Zulu"), 15:21 (14Oct04) Mountain Time)
 
Nice gem - don't remember seeing that in the new features book. Thanks Santa!

-------------------------
The trouble with doing something right the first time is that noboby appreciates how difficult it was.
- Steven Wright
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top