"Date Data" database access in XML schema format

Source: Internet
Author: User

There was an error when the date data in the XML Schema format was stored in the DateTime field in the database

Mysql> SELECT @ @sql_mode; +--------------------------------------------+| @ @sql_mode |+--------------------------------------------+| Strict_trans_tables,no_engine_substitution |+--------------------------------------------+1 row in Set (0.00 sec) mysql> INSERT INTO datetimetest (DT) VALUES (' 2013-08-26t12:00:00+00:00 '); ERROR 1292 (22007): Incorrect datetime value: ' 2013-08-26t12:00:00+00:00 ' for column ' dt ' at row remove strict_trans_t ABLES--Note that executing this is removes it for your--current session--it does don't make a server-wide config chan gemysql> SET @ @sql_mode = ' no_engine_substitution '; Query OK, 0 rows Affected (0.00 sec) mysql> SELECT @ @sql_mode; +------------------------+| @ @sql_mode |+------------------------+| No_engine_substitution |+------------------------+1 row in Set (0.00 sec) – now MySQL would accept the invalid value, with A warningmysql> insert INTO datetimetest (DT) VALUES (' 2013-08-26t12:00:00+00:00 '); Query OK, 1 row affected, 1 Warning (0.00 sec) mysql> Show warnings;+---------+------+-------------------------------- ---------+| Level | Code | Message |+---------+------+-----------------------------------------+| Warning | 1265 | Data truncated for column ' DT ' at row 1 |+---------+------+-----------------------------------------+1 row in Set (0.00 SE c)--the value did get inserted, but the time zone information is lost:mysql> SELECT * from datetimetest;+----+------- --------------+| ID |  DT |+----+---------------------+| 1 | 2013-08-26 12:00:00 |+----+---------------------+1 row in Set (0.00 sec)

  

So run set directly @ @sql_mode = ' no_engine_substitution ';

"Date Data" database access in XML schema format

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.