views:

24

answers:

2

I decleared the column as "datetime",which failed to restore value like above.

+1  A: 

2008-7 isn't a date. 2008-7-1 is a date (the first of July). If you want to store values like 2008-7, you'll want a character field.

T.J. Crowder
A: 

Do you need to clean up the data?

  1. make it a varchar
  2. update t set d = concat(d, '-1')
  3. change it to a date type
ndp