List:General Discussion« Previous MessageNext Message »
From:Tim Dunphy Date:June 28 2014 5:34pm
Subject:Re: alter table modify syntax error
View as plain text  
Cool guys, that did it..

ALTER TABLE car_table MODIFY COLUMN color VARCHAR(10) AFTER model;

For some reason the book I'm following doesn't specify that you have to
note the data type in moves! This helped. and thanks again.

Tim


On Sat, Jun 28, 2014 at 1:24 PM, Carsten Pedersen <carsten@stripped>
wrote:

> On 28-06-2014 19:11, Tim Dunphy wrote:
>
>> Hello,
>>
>> I'm trying to use a very basic alter table command to position a column
>> after another column.
>>
>> This is the table as it exists now:
>>
>> mysql> describe car_table;
>> +---------+--------------+------+-----+---------+----------------+
>> | Field | Type | Null | Key | Default | Extra |
>> +---------+--------------+------+-----+---------+----------------+
>> | car_id | int(11) | NO | PRI | NULL | auto_increment |
>> | vin | varchar(17) | YES | | NULL | |
>> | color | varchar(10) | YES | | NULL | |
>> | year | decimal(4,0) | YES | | NULL | |
>> | make | varchar(10) | YES | | NULL | |
>> | model | varchar(20) | YES | | NULL | |
>> | howmuch | decimal(5,2) | YES | | NULL | |
>> +---------+--------------+------+-----+---------+----------------+
>> 7 rows in set (0.03 sec)
>>
>> I am trying to position the 'color' column after the 'model' column with
>> the following command:
>>
>> mysql> alter table car_table modify column color after model;
>>
>> And I'm getting the following error:
>>
>> ERROR 1064 (42000): 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 'after model' at line 1
>>
>
> Try:
> alter table car_table modify column color varchar(10) after model;
>
> / Carsten
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql
>
>


-- 
GPG me!!

gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B

Thread
alter table modify syntax errorTim Dunphy28 Jun 2014
  • Re: alter table modify syntax errorCarsten Pedersen28 Jun 2014
    • Re: alter table modify syntax errorTim Dunphy28 Jun 2014
      • Re: alter table modify syntax errorTim Dunphy28 Jun 2014
        • RE: alter table modify syntax errorJesper Wisborg Krogh28 Jun 2014
          • Re: alter table modify syntax errorTim Dunphy29 Jun 2014
            • RE: alter table modify syntax errorJesper Wisborg Krogh29 Jun 2014
              • Re: alter table modify syntax errorTim Dunphy29 Jun 2014