How do I change a bad column name?

This is a discussion on How do I change a bad column name? within the MySQL Database forums, part of the Database Forums category; I have a table one of whose columns is named 'interval', which is also a mysql datatype. I don't ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-23-2008
thelma@uwm.edu
 
Posts: n/a
Default How do I change a bad column name?

I have a table one of whose columns is named 'interval', which is also
a mysql datatype. I don't know how easy it is to create such a table,
but it sure isn't easy to use it.

Mysql won't let me access this column in any way that I've tried: I
can't select it or update it; I can't delete it or rename it.
Do I have to recreate the whole table to get rid of it?

thanks, --thelma
Reply With Quote
  #2 (permalink)  
Old 04-23-2008
Rik Wasmus
 
Posts: n/a
Default Re: How do I change a bad column name?

On Wed, 23 Apr 2008 21:36:27 +0200, <thelma@uwm.edu> wrote:

> I have a table one of whose columns is named 'interval', which is also
> a mysql datatype. I don't know how easy it is to create such a table,
> but it sure isn't easy to use it.
>
> Mysql won't let me access this column in any way that I've tried: I
> can't select it or update it; I can't delete it or rename it.
> Do I have to recreate the whole table to get rid of it?


Use backticks to access it:
ALTER tablename CHANGE COLUMN `interval` other_name <rest of column
definition>
--
Rik Wasmus
Reply With Quote
  #3 (permalink)  
Old 04-23-2008
Peter H. Coffin
 
Posts: n/a
Default Re: How do I change a bad column name?

On Wed, 23 Apr 2008 14:36:27 -0500, thelma@uwm.edu wrote:
> I have a table one of whose columns is named 'interval', which is also
> a mysql datatype. I don't know how easy it is to create such a table,
> but it sure isn't easy to use it.
>
> Mysql won't let me access this column in any way that I've tried: I
> can't select it or update it; I can't delete it or rename it.
> Do I have to recreate the whole table to get rid of it?
>
> thanks, --thelma


Quote it with back-tickies, like `interval` and think every time how
annoying it is, and resolve never to permit this kind of foolishness to
happen in the future.

--
12. One of my advisors will be an average five-year-old child. Any flaws in my
plan that he is able to spot will be corrected before implementation.
--Peter Anspach's list of things to do as an Evil Overlord
Reply With Quote
  #4 (permalink)  
Old 04-23-2008
thelma@uwm.edu
 
Posts: n/a
Default Re: How do I change a bad column name?

Peter H. Coffin <hellsop@ninehells.com> wrote:
: On Wed, 23 Apr 2008 14:36:27 -0500, thelma@uwm.edu wrote:
: > I have a table one of whose columns is named 'interval', which is also
: > a mysql datatype. I don't know how easy it is to create such a table,
: > but it sure isn't easy to use it.
: >
: > Mysql won't let me access this column in any way that I've tried: I
: > can't select it or update it; I can't delete it or rename it.
: > Do I have to recreate the whole table to get rid of it?
: >
: > thanks, --thelma

: Quote it with back-tickies, like `interval` and think every time how
: annoying it is, and resolve never to permit this kind of foolishness to
: happen in the future.

Thank you, and thanks also to Rik Wasmus.
I didn't create the table; I just inherited it, but it's kept
me from adding columns called 'limits' and 'done', names
too close to things the database might someday want for itself

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



All times are GMT +1. The time now is 04:27 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0