日志文件中的SQL错误 [英] Sql error in log file

查看:126
本文介绍了日志文件中的SQL错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我是SQL编程的新手,在现场网站中遇到并发布。



我在日志文件中有以下SQL错误。



本地异常堆栈:

异常[EclipseLink-4002]( Eclipse Persistence Services - 2.4.2.v20130514-5956486):org.eclipse.persistence.exceptions.DatabaseException

内部异常:com.microsoft.sqlserver.jdbc.SQLServerException:转换nvarchar值时转换失败'2686000.75'到数据类型int。

错误代码:245

调用:SELECT t0.DFY004_MDL_D,MAX(CAST(t1.DFY006_ATTR_VAL_X AS int)),MIN(CAST (t1.DFY006_ATTR_VAL_X AS int))FROM VDFY006_DERTV_ATTR t1 LEFT OUTER JOIN VDFY003_DERTV t0 ON(t1.DFY003_DERTV_D = t0.DFY003_DERTV_D)WHERE(((((t0.DFY004_MDL_D IN(?,?,?,?,?))AND( t1.DFY005_ATTR_D =?))AND(t1.DFY006_ATTR_VAL_X IS NOT NULL))AND(t1.DFY006_IS_DEL_F =?))AND(t0.DFY014_STAT_D =?))GROUP BY t0.DFY004_MDL_D

bind => [8个参数绑定]

查询:ReportQuery(referenceClass = DerivativeAttribute sql =SELECT t0.DFY004_MDL_D,MAX(CAST(t1.DFY006_ATTR_VAL_X AS int)),MIN(CAST(t1.DFY006_ATTR_VAL_X AS int)) )FROM VDFY006_DERTV_ATTR t1 LEFT OUTER JOIN VDFY003_DERTV t0 ON(t1.DFY003_DERTV_D = t0.DFY003_DERTV_D)WHERE(((((t0.DFY004_MDL_D IN?)AND(t1.DFY005_ATTR_D =?))AND(t1.DFY006_ATTR_VAL_X IS NOT NULL)) AND(t1.DFY006_IS_DEL_F =?))AND(t0.DFY014_STAT_D =?))GROUP BY t0.DFY004_MDL_D)



需要帮助才能理解问题和步骤解决这个问题。



我尝试了什么:



SQL Server帮助程序 [ ^ ]





[ ^ ]

Hi All,

I am newbie to SQL programming and encountering and issue in one of live site.

I have the following SQL error in the log file.

Local Exception Stack:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.4.2.v20130514-5956486): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.microsoft.sqlserver.jdbc.SQLServerException: Conversion failed when converting the nvarchar value '2686000.75' to data type int.
Error Code: 245
Call: SELECT t0.DFY004_MDL_D, MAX(CAST(t1.DFY006_ATTR_VAL_X AS int)), MIN(CAST(t1.DFY006_ATTR_VAL_X AS int)) FROM VDFY006_DERTV_ATTR t1 LEFT OUTER JOIN VDFY003_DERTV t0 ON (t1.DFY003_DERTV_D = t0.DFY003_DERTV_D) WHERE (((((t0.DFY004_MDL_D IN (?,?,?,?,?)) AND (t1.DFY005_ATTR_D = ?)) AND (t1.DFY006_ATTR_VAL_X IS NOT NULL)) AND (t1.DFY006_IS_DEL_F = ?)) AND (t0.DFY014_STAT_D = ?)) GROUP BY t0.DFY004_MDL_D
bind => [8 parameters bound]
Query: ReportQuery(referenceClass=DerivativeAttribute sql="SELECT t0.DFY004_MDL_D, MAX(CAST(t1.DFY006_ATTR_VAL_X AS int)), MIN(CAST(t1.DFY006_ATTR_VAL_X AS int)) FROM VDFY006_DERTV_ATTR t1 LEFT OUTER JOIN VDFY003_DERTV t0 ON (t1.DFY003_DERTV_D = t0.DFY003_DERTV_D) WHERE (((((t0.DFY004_MDL_D IN ?) AND (t1.DFY005_ATTR_D = ?)) AND (t1.DFY006_ATTR_VAL_X IS NOT NULL)) AND (t1.DFY006_IS_DEL_F = ?)) AND (t0.DFY014_STAT_D = ?)) GROUP BY t0.DFY004_MDL_D")

Need help to understand the issue and steps to resolve this.

What I have tried:

SQL Server Helper[^]


[^]

推荐答案

将nvarchar值'2686000.75'转换为数据类型int时转换失败



问题非常明确:数据库中有一列其类型为整数(int),并且您尝试使用字符串(nvarchar)来提供它(此外,此字符串值本身不代表整数值,而是浮点值)。



您应该意识到数据类型的重要性,它们之间的关系以及如何管理它们。
"Conversion failed when converting the nvarchar value '2686000.75' to data type int"

The problem is pretty clear: you have a column in the database whose type is integer (int), and you are trying to feed it with a string (nvarchar) (moreover, this string value does not represent an integer value itself, but rather a floating-point value).

You should realize the importance of data types, how they are related, and how you have to manage them.


这篇关于日志文件中的SQL错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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