ballouta Posted July 20, 2010 Share Posted July 20, 2010 Hello I have an old table (newsletter) whoch contains three columns: email / country / date the date field was of type Date e.g.: 2008-08-03 I changed it to datetime type and it worked fine, the old fields turned to 2008-08-03 00:00:00 the problem: i am using the phpmyadmin page to change the Default option for this field to currrent_timestamp i am getting this error: #1067 - Invalid default value for 'date' Please help Many thanks Quote Link to comment https://forums.phpfreaks.com/topic/208243-altering-tablw-column-to-current-timestamp/ Share on other sites More sharing options...
fenway Posted July 21, 2010 Share Posted July 21, 2010 What version? Quote Link to comment https://forums.phpfreaks.com/topic/208243-altering-tablw-column-to-current-timestamp/#findComment-1089308 Share on other sites More sharing options...
ballouta Posted July 21, 2010 Author Share Posted July 21, 2010 Server version: 5.1.47 Thank you Quote Link to comment https://forums.phpfreaks.com/topic/208243-altering-tablw-column-to-current-timestamp/#findComment-1089329 Share on other sites More sharing options...
fenway Posted July 23, 2010 Share Posted July 23, 2010 What alter statement are you talking about? Quote Link to comment https://forums.phpfreaks.com/topic/208243-altering-tablw-column-to-current-timestamp/#findComment-1090351 Share on other sites More sharing options...
gizmola Posted July 23, 2010 Share Posted July 23, 2010 Probably needs to be CURRENT_TIMESTAMP. Has to be uppercase. Quote Link to comment https://forums.phpfreaks.com/topic/208243-altering-tablw-column-to-current-timestamp/#findComment-1090352 Share on other sites More sharing options...
ballouta Posted July 23, 2010 Author Share Posted July 23, 2010 yes it is uppercase, actually i am using the phpmyadmin to do this. thank you Quote Link to comment https://forums.phpfreaks.com/topic/208243-altering-tablw-column-to-current-timestamp/#findComment-1090363 Share on other sites More sharing options...
Mchl Posted July 23, 2010 Share Posted July 23, 2010 I think in PhpMyAdmin there's actually a dedicated checkbox for CURRENT_TIMESTAMP. If you enter this in textfield, PMA probably puts this in quotes and hence the error. Quote Link to comment https://forums.phpfreaks.com/topic/208243-altering-tablw-column-to-current-timestamp/#findComment-1090365 Share on other sites More sharing options...
ballouta Posted July 23, 2010 Author Share Posted July 23, 2010 here's snap shot for the error and the table itself [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/208243-altering-tablw-column-to-current-timestamp/#findComment-1090368 Share on other sites More sharing options...
Mchl Posted July 23, 2010 Share Posted July 23, 2010 CURRENT_TIMESTAMP is only for TIMESTAMP datatype. Quote Link to comment https://forums.phpfreaks.com/topic/208243-altering-tablw-column-to-current-timestamp/#findComment-1090371 Share on other sites More sharing options...
ballouta Posted July 23, 2010 Author Share Posted July 23, 2010 Thank you so much it is fine now Quote Link to comment https://forums.phpfreaks.com/topic/208243-altering-tablw-column-to-current-timestamp/#findComment-1090376 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.