mysql - CSV import via PHPMyAdmin, blank timestamp results in 0000-00-00 00:00:00 -
the destination table has column named updated
, set as:
name: updated type: timestamp attributes: on update current_timestamp null: no default: current_timestamp extra: on update current_timestamp
the source data in csv, updated
field blank every row, e.g.
id,item_name,updated,quantity 1,car,,4 2,truck,,5 3,chair,,5
after importing using phpmyadmin, expect see updated
column filled current date/time when import executed, however, 0000-00-00 00:00:00
instead.
mysql version: 5.5.30. result same myisam , innodb.
that because field supplied. supplied empty string, different null
or default.
empty strings converted 0
when cast numeric value. , timestamp 0
formatted date 0000-00-00 00:00:00
.
you can either run update table set updated=now()
after importing (if import complete set) or remove entire column csv.
Comments
Post a Comment