Re: MySQL and Date Type columns with 2005-05-00 contents




<news@xxxxxxxxxxxxxxxxx> wrote in message
news:1135086154.210908.18720@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Hi,
> I'm currently trying to read a table from an MySQL database that has a
> column of type Date which might contain entries like 2005-05-00.
> Everything works as expected when it's used from PHP, but when I do an
> getString on the resultSet, the Date Column gets converted to an Java
> SQL Date type which does not accept such a Date field. And thus gives
> me the result 2005-04-31. But what I really want is just the Date
> Column as a STRING. I don't want it to get converted somewhere...
> Btw, the 2005-05-00 should represent a Date where the Day is unknown or
> not applicable. And I definitly need those cases...
> Thanks for any hints in advance,
> Karsten
>

Sounds like a huge bug in MySQL that it allows you to store such a "date".
Although I can imagine some reasons why you might want this you simply
should not do this with a Date column in a relational database.

I suspect there will be few other DBMS systems that will let you get away
with this.

Silvio Bierman


.



Relevant Pages

  • MySQL and Date Type columns with 2005-05-00 contents
    ... I'm currently trying to read a table from an MySQL database that has a ... column of type Date which might contain entries like 2005-05-00. ... the 2005-05-00 should represent a Date where the Day is unknown or ... Thanks for any hints in advance, ...
    (comp.lang.java.databases)
  • redirecting stdout to a mysql database
    ... Is it possible to redirect the output of a command to a ... Thank you for your time and for any hints. ...
    (comp.unix.questions)