jenniferG Posted September 9, 2007 Share Posted September 9, 2007 WE HAVE A TABLE WHERE WE WANT TO SET A DEFAULT VALUE OF A COLUMN FROM THE mysql->PROMPT. WE HAVE TRIED EVERYTHJNG WE CAN THINK OF THIS IS THE LATEST- ALTER TABLE SIREQUESTTABLE MODIFY CARRIER (SET DEFAULT 'NA');THANKS, Jennifer Link to comment https://forums.phpfreaks.com/topic/68601-alter-syntax/ Share on other sites More sharing options...
GingerRobot Posted September 9, 2007 Share Posted September 9, 2007 The correct syntax is: ALTER TABLE `tablename` CHANGE `fieldname` `newfieldname` FIELD TYPE DEFAULT 'Default value' For example, to set the default on an int field back to 0, you might do something like: ALTER TABLE `ratings` CHANGE `timestamp` `timestamp` INT( 50 ) NOT NULL DEFAULT '0' p.s. Please don't type in capitals. It's incredibly annoying. Link to comment https://forums.phpfreaks.com/topic/68601-alter-syntax/#findComment-344919 Share on other sites More sharing options...
fenway Posted September 9, 2007 Share Posted September 9, 2007 You can use MODIFY too, then you don't need to repeat the column name. Link to comment https://forums.phpfreaks.com/topic/68601-alter-syntax/#findComment-345013 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.