在执行liquibase脚本期间,我用数据填充了表。数据有一个带有下一个值的列:2017-10-03T07:11:00.0000000Z我正在努力解析到该列中:
liquibase.exception.MigrationFailedException: Migration failed for change set /changelog/00000000000001.xml::00000000000001::IAmUser:
Reason: java.lang.NumberFormatException: For input string: "0000000Z"
我尝试了多种列类型,但没有一种起作用:datetime,datetime2,timestamp(datetimeoffset在MySQL中不起作用)。
如何将此日期解析为SQL列?
最佳答案
使用datetime(6)
/ timestamp(6)
,其中6是小数秒的精度。另外,在日期字符串的末尾省略Z
。