MySQL Data truncation: Incorrect datetime value

The MySQL error, Data truncation: Incorrect datetime value, is rather obvious and is caused by trying to insert a non datetime value into a datetime field in MYSQL 5.1. I was surprised to find the same code would run without error on MySQL 4.1. Apparently, earlier versions of MySQL would convert incorrect datetime values into 0000-00-00 00:00:00 and proceed without error. It seems that throwing the error is a better option to alert the developer of a problem if they are attempting to insert a non datetime value into a datetime value field.

Comments

2
Neo

Do you have a MyRides DB? I could not find it in the zip download. Txs

3
John Sieber

@Neo - I do and can post a link to it this evening.

Write your comment

(it will not be displayed)

Leave this field empty: