如何允許 MySQL 儲存無效日期?
啟用 SQL 模式為 ALLOW_INVALID_DATES 後,MySQL 還可以將無效日期儲存在表中。下面給出示例,以便理解 −
mysql> Insert into order1234(ProductName, Quantity, Orderdate) values('B',500,'2015-11-31'); Query OK, 1 row affected (0.06 sec) mysql> Select * from order1234; +-------------+----------+--------------+ | ProductName | Quantity | OrderDate | +-------------+----------+--------------+ | A | 500 | 0000-00-00 | | B | 500 | 2015-11-31 | +-------------+----------+--------------+ 2 rows in set (0.00 sec)
我們看到 MySQL 也將無效日期插入表中。
廣告