Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
Column Rename - Major problem
Old 05-09-2007, 02:40 PM Column Rename - Major problem
afridy's Avatar
Extreme Talker

Posts: 196
Trades: 0
Hai all

I wonder actually whats wrong with this query?

mysql>ALTER TABLE distributors RENAME COLUMN city TO state

Mysql says syntax error.


Note:- I have loged on as Root.
afridy is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-09-2007, 02:51 PM Re: Column Rename - Major problem
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
MySQL is

ALTER TABLE tbl_name CHANGE old_col_name new_col_name columntype
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-09-2007, 03:32 PM Re: Column Rename - Major problem
afridy's Avatar
Extreme Talker

Posts: 196
Trades: 0
Thanks Chrishirst

What should i specify for the columntype.
i executed like this
mysql>ALTER TABLE distributors CHANGE city TO state varchar(20);
Is this correct?
afridy is offline
Reply With Quote
View Public Profile
 
Old 05-10-2007, 04:27 AM Re: Column Rename - Major problem
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
columntype should be either;

The same type as the column is;

or

A new type to change the column into (not recommended for populated tables)

so yes, your syntax is correct.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-10-2007, 07:02 AM Re: Column Rename - Major problem
afridy's Avatar
Extreme Talker

Posts: 196
Trades: 0
Thanks Chrishirst for the effort. it worked !!
afridy is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Column Rename - Major problem
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15202 seconds with 12 queries