List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:September 12 2001 10:17pm
Subject:Re: Renaming Columns...
View as plain text  
>How??? ALTER TABLE table1 RENAME ???
>Tried it, dont work.

That renames the table itself.

ALTER TABLE tbl_name CHANGE old_name new_name column_definition

where column_definition is how you defined the column when you created
it.  For example if you have a table

CREATE TABLE xyz
(
     c CHAR(30) NOT NULL
)

Then you can rename c to d like this:

ALTER TABLE xyz CHANGE c d CHAR(30) NOT NULL

To answer your next question :-), no, you can't do it without
repeating the column definition.

>- Deryck H
>- http://www.comp-u-exchange.com


-- 
Paul DuBois, paul@stripped
Thread
Renaming Columns...Deryck Henson12 Sep
  • Re: Renaming Columns...Paul DuBois13 Sep
  • SV: Renaming Columns...Ann Myhre13 Sep