If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Change column heading in table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-14-11, 05:30
melgra70 melgra70 is offline
Registered User
 
Join Date: Mar 2011
Location: Sydney, Australia
Posts: 58
Change column heading in table

I need to change the name of a column in one of my tables.
The table is “judge”
The column is “Address” which needs to change to “Suburb”.

I’ve looked for answers and come up with:

alter table judge change address to ‘Suburb’;

The syntax error indicates it is near ‘to ‘Suburb’’; I’m not even sure I’m using the correct statement. Can you help, please?
Reply With Quote
  #2 (permalink)  
Old 03-14-11, 06:03
it-iss.com it-iss.com is offline
Registered User
 
Join Date: Sep 2009
Location: San Sebastian, Spain
Posts: 623
This is almost correct. When renaming a column you also need to provide the data type.

Code:
ALTER TABLE judge CHANGE Address Suburb VARCHAR(100);
__________________
Ronan Cashell
Senior Oracle/MySQL DBA
http://www.it-iss.com
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On