An how to rename a column name of database table query plz
Printable View
An how to rename a column name of database table query plz
Which RDBMS you have?Quote:
An how to rename a column name of database table query plz
For Oracle it would be this:
Code:ALTER TABLE mytable RENAME COLUMN col1 TO col2;
i am using MS-ACCESS
Below is the syntax for the alter table statement borrowed from Microsoft Access 2003 help system.
The ALTER TABLE statement has these parts:Code:ALTER TABLE table {ADD {COLUMN field type[(size)] [NOT NULL] [CONSTRAINT index] |
ALTER COLUMN field type[(size)] |
CONSTRAINT multifieldindex} |
DROP {COLUMN field I CONSTRAINT indexname} }
Part Description
table The name of the table to be altered.
field The name of the field to be added to or deleted from table. Or, the name of the field to be altered in table.
type The data type of field.
size The field size in characters (Text and Binary fields only).
index The index for field.
multifieldindex The definition of a multiple-field index to be added to table.
indexname The name of the multiple-field index to be removed.
It seems that it isn't possible to rename am an existing column. For that reason you should add a new column, copy the data, then delete the original column.
Hth and good luck