In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces how to set the default value of datetime type in mysql. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.
The database table field type datetime originally defaults to NULL. When the default value is set to the current time through the interface, the prompt "1067-Invalid default value for 'CREATE_TM'" is prompted, but this problem will not occur when the table is created, such as the table statement:
CREATE TABLE `bigint (21) unsigned NOT NULL AUTO_INCREMENT COMMENT 'key ID', `app_ id` varchar (30) DEFAULT NULL COMMENT' application code', `package_ name` varchar (30) DEFAULT NULL COMMENT 'application name', `package_ name` varchar (100) DEFAULT NULL COMMENT 'package name', `version`int (11) DEFAULT NULL COMMENT 'version', `version_ name`varchar (20) DEFAULT NULL COMMENT 'version name', `icon_ url` varchar 'DEFAULT NULL COMMENT' Icon address' `download_ url`varchar 'DEFAULT NULL COMMENT' download address', `uploy` varchar 'DEFAULT NULL COMMENT' summary', `description ``varchar (512) DEFAULT NULL COMMENT 'description', `app_ status`int (4) DEFAULT'0' COMMENT 'status 0: available 1: delete', 'create_ time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT' creation time', `create_ user` varchar (30) DEFAULT NULL COMMENT 'creator', `modify_ time`time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'modification time', `modify_ user` varchar (30) DEFAULT NULL COMMENT 'modifier', PRIMARY KEY (`id`) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8
Then I tried to modify the field directly through the script, which is also OK, as follows:
Alter table ts_role MODIFY column create_tm datetime default CURRENT_TIMESTAMP COMMENT 'creation time' about how to set the default value of datetime type in mysql is shared here. I hope the above content can be helpful to you and learn more. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.