Tuesday, August 14, 2007

SQL Brain Teaser - Why "an Incorrect datetime value"?

Kostyantyn ran into this issue today. I was totally clueless till he got it sorted out.

Suppose you have a table like so:
  CREATE TABLEE foo(timevalue timestamp);

You successful run the following INSERT:
  INSERT INTO foo(timevalue) values ('2007-03-11 01:53:44');

You attempt to run the following INSERT:
  INSERT INTO foo(timevalue) values ('2007-03-11 02:53:44');

You get the error:
  error# 1292: Incorrect datetime value: '2007-03-11 02:53:44' for column timevalue

What's the problem? How do you fix it?

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails