Example: Rename a Column
The following example renames two columns, name and addr, to employee and address. The salary column is not renamed.
Using SQL:
1. Create a temporary table with all columns from the original table, renaming the desired columns. For example:
create table temp as
select name as employee, addr as address, salary
from test;
2. Drop the original table:
drop test;
3. Re-create the original table with the columns from the temporary table:
create table test as
select * from temp;
4. 4. Drop the temporary table:
drop temp;
In VDBA, follow these steps to rename such columns:
5. Assuming the table test already exists with columns name, addr, and salary, create a temporary table named temp.
6. Enable Create Table As Select in the Create Table dialog.
7. In the Select Statement edit control, enter the following select statement to rename the desired columns:
select name as employee, addr as address, salary
from test
8. Drop the original table, test.
9. Create a new table named test.
10. Enable Create Table As Select in the Create Table dialog.
11. In the Select Statement edit control, enter:
select * from temp
12. Drop the temporary table, temp.
Be sure to update any objects, such as reports, forms, and programs that are dependent on the old column name, and recreate integrities, views, indexes, grants, and other dependent objects that were destroyed when the original table was dropped.