Hi,
I am trying to alter the columns within an existing table to change them so
they do not accept NULL values.
I have tried using the sql statement: ALTER TABLE tbltwptcsvehicle MODIFY
Vehicle_ID NOT NULL;
but that generates error 1064, I don't know what is the correct SQL.
Help much appreciated
Graham Kendall
Murray - 07 May 2004 18:25 GMT
> Hi,
>
[quoted text clipped - 9 lines]
>
> Graham Kendall
You have to specify the type as well, e.g.
ALTER TABLE tbltwptcsvehicle MODIFY Vehicle_ID int NOT NULL;
Bill Karwin - 07 May 2004 19:08 GMT
> I am trying to alter the columns within an existing table to change them so
> they do not accept NULL values.
> I have tried using the sql statement:
> ALTER TABLE tbltwptcsvehicle MODIFY Vehicle_ID NOT NULL;
In reading http://dev.mysql.com/doc/mysql/en/ALTER_TABLE.html, it
appears that the alter table syntax doesn't support changing solely the
nullability of a column. You must supply a column definition, including
the datatype and any other attributes.
For example:
ALTER TABLE tbltwptcsvehicle MODIFY Vehicle_ID VARCHAR(20) NOT NULL
PRIMARY KEY;
The datatype and other attributes can be identical to their previous
definition (I'm guessing at the datatype in your case).
Regards,
Bill K.