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 Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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.