SQLCODE -181日期值的字符串表示不是有效的日期值 [英] SQLCODE -181 THE STRING REPRESENTATION OF A DATETIME VALUE IS NOT A VALID DATETIME VALUE
问题描述
当我给 0001-01-01 00:00:00.000000
时间戳时,我收到日期值的字符串表示不是有效日期值字段。但是当我将 0001
更改为 0002
以 0002-01-01 00:00: 00.000000
从输入的时间戳字段,我的代码工作正常没有任何错误。为什么会这样? java不支持 0001-01-01 00:00:00.000000
时间戳的值?
DB2作为我的数据库。
在DB2中,SQLCODE SQL0181意味着给定的表示无效
db2?但是,当我在DB2中写入日期时,它接受它: db2values timestamp('0001-01-01 00:00:00.000000')
1
--------------------------
0001-01-01 00:00:00.000000
1条记录(s)选择。
但是,当我放置一个无效的日期,比如13个月,它会返回你的错误代码
db2values timestamp('0001-13-01 00:00:00.000000')
1
--------------------------
SQL0181N datetime值的字符串表示超出范围。
我认为你有一个区域设置和区域设置的问题不符合提供的datetime。 / p>
运行此命令,然后开始修改日期
db2值当前时间戳
表6.日期时间限制 b
$ b
- 最小TIMESTAMP值0001-01-01-00.00.00.000000000000
- 最大TIMESTAMP值9999-12-31-24.00 .00.000000000000
I'm getting " THE STRING REPRESENTATION OF A DATETIME VALUE IS NOT A VALID DATETIME VALUE" when I give 0001-01-01 00:00:00.000000
for timestamp field from input. But when I change 0001
to 0002
given as 0002-01-01 00:00:00.000000
for timestamp field from input, my code is working fine without any error. Why it is so? Will java not support 0001-01-01 00:00:00.000000
value for timestamp?
I'm using DB2 as my Database.
解决方案 In DB2, SQLCODE SQL0181 means that the given representation is not valid
db2 ? sql0181
However, when I write in DB2 your date, it accepts it:
db2 "values timestamp('0001-01-01 00:00:00.000000')"
1
--------------------------
0001-01-01 00:00:00.000000
1 record(s) selected.
However, when I put an invalid date, like 13 months, it returns your error code
db2 "values timestamp('0001-13-01 00:00:00.000000')"
1
--------------------------
SQL0181N The string representation of a datetime value is out of range.
I think you have a problem of locale and regional settings that does not correspond to the provided datetime.
Run this command, and then start modifying the date
db2 "values current timestamp"
Table 6. Datetime Limits
- Smallest TIMESTAMP value 0001-01-01-00.00.00.000000000000
- Largest TIMESTAMP value 9999-12-31-24.00.00.000000000000
http://pic.dhe.ibm.com/infocenter/db2luw/v10r5/topic/com.ibm.db2.luw.sql.ref.doc/doc/r0001029.html
这篇关于SQLCODE -181日期值的字符串表示不是有效的日期值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!