469,945 Members | 1,858 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,945 developers. It's quick & easy.

Cannot change column name.

I inadvertantly named a field "in"

mysql> select * from guestbook;
+----+-------+-------+-----------------+----------------+
| id | fname | lname | comments | in |
+----+-------+-------+-----------------+----------------+
| 1 | Mick | White | Test 123 | 20050208000000 |
| 2 | Ann | White | Hello World | 20050213101948 |
| 3 | | | It's a nice day | 20050213102405 |
+----+-------+-------+-----------------+----------------+
mysql> select in from guestbook;
ERROR 1064: You have an error in your SQL syntax. Check the manual that
corresponds to your MySQL server version for the right syntax to use
near 'in from guestbook' at line 1

But I can't seem to be able to change it:
mysql> alter guestbook change in time_in;
ERROR 1064: You have an error in your SQL syntax. Check the manual that
corresponds to your MySQL server version for the right syntax to use
near 'guestbook change in time_in' at line 1

The table:
mysql> desc guestbook;
+----------+-----------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+-----------------+------+-----+---------+----------------+
| id | int(4) unsigned | | PRI | NULL | auto_increment |
| fname | varchar(10) | | PRI | | |
| lname | varchar(10) | | | | |
| comments | text | | | | |
| in | timestamp(14) | YES | | NULL | |
+----------+-----------------+------+-----+---------+----------------+

Any takers?
Mick
Jul 23 '05 #1
2 2118
On Sun, 13 Feb 2005 18:56:29 GMT, in mailing.database.mysql Mick White
<mw***********@rochester.rr.com> wrote:
| I inadvertantly named a field "in"
|
| mysql> select * from guestbook;
| +----+-------+-------+-----------------+----------------+
| | id | fname | lname | comments | in |
| +----+-------+-------+-----------------+----------------+
| | 1 | Mick | White | Test 123 | 20050208000000 |
| | 2 | Ann | White | Hello World | 20050213101948 |
| | 3 | | | It's a nice day | 20050213102405 |
| +----+-------+-------+-----------------+----------------+
| mysql> select in from guestbook;
| ERROR 1064: You have an error in your SQL syntax. Check the manual that
| corresponds to your MySQL server version for the right syntax to use
| near 'in from guestbook' at line 1
|
| But I can't seem to be able to change it:
| mysql> alter guestbook change in time_in;
| ERROR 1064: You have an error in your SQL syntax. Check the manual that
| corresponds to your MySQL server version for the right syntax to use
| near 'guestbook change in time_in' at line 1
|
| The table:
| mysql> desc guestbook;
| +----------+-----------------+------+-----+---------+----------------+
| | Field | Type | Null | Key | Default | Extra |
| +----------+-----------------+------+-----+---------+----------------+
| | id | int(4) unsigned | | PRI | NULL | auto_increment |
| | fname | varchar(10) | | PRI | | |
| | lname | varchar(10) | | | | |
| | comments | text | | | | |
| | in | timestamp(14) | YES | | NULL | |
| +----------+-----------------+------+-----+---------+----------------+
|


ALTER TABLE `t2` CHANGE COLUMN `in` `time_in` TIMESTAMP(14);
---------------------------------------------------------------
jn******@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Jul 23 '05 #2
Jeff North wrote:


ALTER TABLE `t2` CHANGE COLUMN `in` `time_in` TIMESTAMP(14);

Thanks, Jeff, that did the trick.
Mick
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Lori Markle via .NET 247 | last post: by
3 posts views Thread by kjqua | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.