Jump to content

[SOLVED] change column names


Lodius2000

Recommended Posts

You don't need the select.  alter table is a command on its own.  Try this:

 

ALTER TABLE t CHANGE COLUMN old_name new_name INTEGER

 

Make sure you give the same type as the column was before.  The docs say this:

 

You can rename a column using a CHANGE old_col_name new_col_name column_definition clause. To do so, specify the old and new column names and the definition that the column currently has. For example, to rename an INTEGER column from a to b, you can do this:

 

ALTER TABLE t1 CHANGE a b INTEGER;

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.