By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,665 Members | 1,900 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,665 IT Pros & Developers. It's quick & easy.

Cannot change column name.

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.