执行SPROC时,算术运算溢出错误将十进制转换为数值类型的数据 [英] Arithmetic metic overflow error converting decimal to data type numeric while executing a SPROC

查看:84
本文介绍了执行SPROC时,算术运算溢出错误将十进制转换为数值类型的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

在执行将数据从登台DB传输到主DB的SPROC时,出现算术溢出错误,将十进制转换为数据类型数值".
我知道缩放和精度不匹配存在问题,尽管更改主数据库的缩放和精度对我来说不是一个选择.任何建议,请

Hi All,

While executing a SPROC which transfers data from staging DB to Main DB am getting "Arithmetic overflow error converting decimal to data type numeric".

i understand that there is a issue with the scale and precision mismatch, though changing the Main DB scale and precision is not an option for me. Any suggestions please

推荐答案

您是对的,这是一个规模和精度问题.

检查您为该字段使用的小数位数和精度.
这是一个例子
假设您声明了一个数据类型小数(8,5)
也就是说,在8位数字中,5是小数点.因此,您可以将最大值设为999.
如果您的值大于或等于1000,则将获得异常.

因此,调查设置的十进制数据类型和要传递的值.

希望这可以解决您的问题.

干杯
You are right, this is a scale and precision issue.

Check what decimal scale and precision you have used for the field.
Here is an example
suppose, you declare a data type decimal(8,5)
that means out of 8 digits, 5 will be the decimal point. So, you can have max value 999.
If you have value 1000 or more, you will get the exception.

So, investigate the decimal datatype you have set and the values you are passing.

Hopefully, this solves your problem.

cheers


如果精度存在问题,则在存储的过程中,在传输数据之前,先对精度数使用舍入选项.但是仍然会导致一些数据丢失.理想的解决方案仍然是更改数据类型的规模和精度
if there is an issue with precision then before in the stored proc, use rounding options to the number of precisions before transferring the data. But still it will result in some data loss. The ideal solution will be still changing the scale and precision in datatype


这篇关于执行SPROC时,算术运算溢出错误将十进制转换为数值类型的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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