SQLCODE -181日期值的字符串表示不是有效的日期值 [英] SQLCODE -181 THE STRING REPRESENTATION OF A DATETIME VALUE IS NOT A VALID DATETIME VALUE

查看:1705
本文介绍了SQLCODE -181日期值的字符串表示不是有效的日期值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我给 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



http://pic.dhe.ibm.com/infocenter/db2luw/v10r5/topic/com.ibm。 db2.luw.sql.ref.doc / doc / r0001029.html


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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆