tommo74 Posted December 5, 2007 Share Posted December 5, 2007 I want to add a column to a table that holds datatype INT with a default of 0 and the maximum digits allowed in the column is 3. This : ALTER TABLE Person ADD Age INT(3) DEFAULT 0; gives the following error : ERROR: parser: parse error at or near "(" at character 31 Any help ? Quote Link to comment https://forums.phpfreaks.com/topic/80255-alter-table-error/ Share on other sites More sharing options...
BenInBlack Posted December 5, 2007 Share Posted December 5, 2007 You have to use Decimal or Numeric to control the length DECIMAL(3,0) I would use TINYINT you save on space and dont slow down searches on large data see http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html Quote Link to comment https://forums.phpfreaks.com/topic/80255-alter-table-error/#findComment-406814 Share on other sites More sharing options...
fenway Posted December 5, 2007 Share Posted December 5, 2007 That's a php error, not a mysql error... nothing to do with the data type. Quote Link to comment https://forums.phpfreaks.com/topic/80255-alter-table-error/#findComment-406923 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.